home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Compilers⁄Interps / GCC-2.3.3r12 / Sources / expr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-24  |  229.0 KB  |  7,471 lines  |  [TEXT/MPS ]

  1. /* Convert tree expression to rtl instructions, for GNU compiler.
  2.    Copyright (C) 1988, 1992 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. #include "config.h"
  22. #include "rtl.h"
  23. #include "tree.h"
  24. #include "flags.h"
  25. #include "function.h"
  26. #include "insn-flags.h"
  27. #include "insn-codes.h"
  28. #include "expr.h"
  29. #include "insn-config.h"
  30. #include "recog.h"
  31. #include "output.h"
  32. #include "gvarargs.h"
  33. #include "typeclass.h"
  34.  
  35. #define CEIL(x,y) (((x) + (y) - 1) / (y))
  36.  
  37. /* Decide whether a function's arguments should be processed
  38.    from first to last or from last to first.  */
  39.  
  40. #ifdef STACK_GROWS_DOWNWARD
  41. #ifdef PUSH_ROUNDING
  42. #define PUSH_ARGS_REVERSED    /* If it's last to first */
  43. #endif
  44. #endif
  45.  
  46. #ifndef STACK_PUSH_CODE
  47. #ifdef STACK_GROWS_DOWNWARD
  48. #define STACK_PUSH_CODE PRE_DEC
  49. #else
  50. #define STACK_PUSH_CODE PRE_INC
  51. #endif
  52. #endif
  53.  
  54. /* Like STACK_BOUNDARY but in units of bytes, not bits.  */
  55. #define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
  56.  
  57. /* If this is nonzero, we do not bother generating VOLATILE
  58.    around volatile memory references, and we are willing to
  59.    output indirect addresses.  If cse is to follow, we reject
  60.    indirect addresses so a useful potential cse is generated;
  61.    if it is used only once, instruction combination will produce
  62.    the same indirect address eventually.  */
  63. int cse_not_expected;
  64.  
  65. /* Nonzero to generate code for all the subroutines within an
  66.    expression before generating the upper levels of the expression.
  67.    Nowadays this is never zero.  */
  68. int do_preexpand_calls = 1;
  69.  
  70. /* Number of units that we should eventually pop off the stack.
  71.    These are the arguments to function calls that have already returned.  */
  72. int pending_stack_adjust;
  73.  
  74. /* Nonzero means stack pops must not be deferred, and deferred stack
  75.    pops must not be output.  It is nonzero inside a function call,
  76.    inside a conditional expression, inside a statement expression,
  77.    and in other cases as well.  */
  78. int inhibit_defer_pop;
  79.  
  80. #ifdef APPLE_HAX
  81. /* Total space used by locals and stuff in this function. (why?) */
  82. int max_stack_used;
  83. #endif /* APPLE_HAX */
  84. /* A list of all cleanups which belong to the arguments of
  85.    function calls being expanded by expand_call.  */
  86. tree cleanups_this_call;
  87.  
  88. /* Nonzero means __builtin_saveregs has already been done in this function.
  89.    The value is the pseudoreg containing the value __builtin_saveregs
  90.    returned.  */
  91. static rtx saveregs_value;
  92.  
  93. rtx store_expr ();
  94. static void store_constructor ();
  95. static rtx store_field ();
  96. static rtx expand_builtin ();
  97. static rtx compare ();
  98. static rtx do_store_flag ();
  99. static void preexpand_calls ();
  100. static rtx expand_increment ();
  101. static void init_queue ();
  102.  
  103. void do_pending_stack_adjust ();
  104. static void do_jump_for_compare ();
  105. static void do_jump_by_parts_equality ();
  106. static void do_jump_by_parts_equality_rtx ();
  107. static void do_jump_by_parts_greater ();
  108.  
  109. /* Record for each mode whether we can move a register directly to or
  110.    from an object of that mode in memory.  If we can't, we won't try
  111.    to use that mode directly when accessing a field of that mode.  */
  112.  
  113. static char direct_load[NUM_MACHINE_MODES];
  114. static char direct_store[NUM_MACHINE_MODES];
  115.  
  116. /* MOVE_RATIO is the number of move instructions that is better than
  117.    a block move.  */
  118.  
  119. #ifndef MOVE_RATIO
  120. #if defined (HAVE_movstrqi) || defined (HAVE_movstrhi) || defined (HAVE_movstrsi) || defined (HAVE_movstrdi) || defined (HAVE_movstrti)
  121. #define MOVE_RATIO 2
  122. #else
  123. /* A value of around 6 would minimize code size; infinity would minimize
  124.    execution time.  */
  125. #define MOVE_RATIO 15
  126. #endif
  127. #endif
  128.  
  129. /* This array records the insn_code of insns to perform block moves.  */
  130. static enum insn_code movstr_optab[NUM_MACHINE_MODES];
  131.  
  132. /* SLOW_UNALIGNED_ACCESS is non-zero if unaligned accesses are very slow. */
  133.  
  134. #ifndef SLOW_UNALIGNED_ACCESS
  135. #define SLOW_UNALIGNED_ACCESS 0
  136. #endif
  137.  
  138. /* This is run once per compilation to set up which modes can be used
  139.    directly in memory and to initialize the block move optab.  */
  140.  
  141. void
  142. init_expr_once ()
  143. {
  144.   rtx insn, pat;
  145.   enum machine_mode mode;
  146.   /* Try indexing by frame ptr and try by stack ptr.
  147.      It is known that on the Convex the stack ptr isn't a valid index.
  148.      With luck, one or the other is valid on any machine.  */
  149.   rtx mem = gen_rtx (MEM, VOIDmode, stack_pointer_rtx);
  150.   rtx mem1 = gen_rtx (MEM, VOIDmode, frame_pointer_rtx);
  151.  
  152.   start_sequence ();
  153.   insn = emit_insn (gen_rtx (SET, 0, 0));
  154.   pat = PATTERN (insn);
  155.  
  156.   for (mode = VOIDmode; (int) mode < NUM_MACHINE_MODES;
  157.        mode = (enum machine_mode) ((int) mode + 1))
  158.     {
  159.       int regno;
  160.       rtx reg;
  161.       int num_clobbers;
  162.  
  163.       direct_load[(int) mode] = direct_store[(int) mode] = 0;
  164.       PUT_MODE (mem, mode);
  165.       PUT_MODE (mem1, mode);
  166.  
  167.       /* See if there is some register that can be used in this mode and
  168.      directly loaded or stored from memory.  */
  169.  
  170.       if (mode != VOIDmode && mode != BLKmode)
  171.     for (regno = 0; regno < FIRST_PSEUDO_REGISTER
  172.          && (direct_load[(int) mode] == 0 || direct_store[(int) mode] == 0);
  173.          regno++)
  174.       {
  175.         if (! HARD_REGNO_MODE_OK (regno, mode))
  176.           continue;
  177.  
  178.         reg = gen_rtx (REG, mode, regno);
  179.  
  180.         SET_SRC (pat) = mem;
  181.         SET_DEST (pat) = reg;
  182.         if (recog (pat, insn, &num_clobbers) >= 0)
  183.           direct_load[(int) mode] = 1;
  184.  
  185.         SET_SRC (pat) = mem1;
  186.         SET_DEST (pat) = reg;
  187.         if (recog (pat, insn, &num_clobbers) >= 0)
  188.           direct_load[(int) mode] = 1;
  189.  
  190.         SET_SRC (pat) = reg;
  191.         SET_DEST (pat) = mem;
  192.         if (recog (pat, insn, &num_clobbers) >= 0)
  193.           direct_store[(int) mode] = 1;
  194.  
  195.         SET_SRC (pat) = reg;
  196.         SET_DEST (pat) = mem1;
  197.         if (recog (pat, insn, &num_clobbers) >= 0)
  198.           direct_store[(int) mode] = 1;
  199.       }
  200.  
  201.       movstr_optab[(int) mode] = CODE_FOR_nothing;
  202.     }
  203.  
  204.   end_sequence ();
  205.  
  206. #ifdef HAVE_movstrqi
  207.   if (HAVE_movstrqi)
  208.     movstr_optab[(int) QImode] = CODE_FOR_movstrqi;
  209. #endif
  210. #ifdef HAVE_movstrhi
  211.   if (HAVE_movstrhi)
  212.     movstr_optab[(int) HImode] = CODE_FOR_movstrhi;
  213. #endif
  214. #ifdef HAVE_movstrsi
  215.   if (HAVE_movstrsi)
  216.     movstr_optab[(int) SImode] = CODE_FOR_movstrsi;
  217. #endif
  218. #ifdef HAVE_movstrdi
  219.   if (HAVE_movstrdi)
  220.     movstr_optab[(int) DImode] = CODE_FOR_movstrdi;
  221. #endif
  222. #ifdef HAVE_movstrti
  223.   if (HAVE_movstrti)
  224.     movstr_optab[(int) TImode] = CODE_FOR_movstrti;
  225. #endif
  226. }
  227.       
  228. /* This is run at the start of compiling a function.  */
  229.  
  230. void
  231. init_expr ()
  232. {
  233.   init_queue ();
  234.  
  235.   pending_stack_adjust = 0;
  236.   inhibit_defer_pop = 0;
  237.   cleanups_this_call = 0;
  238.   saveregs_value = 0;
  239.   forced_labels = 0;
  240. }
  241.  
  242. /* Save all variables describing the current status into the structure *P.
  243.    This is used before starting a nested function.  */
  244.  
  245. void
  246. save_expr_status (p)
  247.      struct function *p;
  248. {
  249.   /* Instead of saving the postincrement queue, empty it.  */
  250.   emit_queue ();
  251.  
  252.   p->pending_stack_adjust = pending_stack_adjust;
  253.   p->inhibit_defer_pop = inhibit_defer_pop;
  254.   p->cleanups_this_call = cleanups_this_call;
  255.   p->saveregs_value = saveregs_value;
  256.   p->forced_labels = forced_labels;
  257.  
  258.   pending_stack_adjust = 0;
  259.   inhibit_defer_pop = 0;
  260.   cleanups_this_call = 0;
  261.   saveregs_value = 0;
  262.   forced_labels = 0;
  263. }
  264.  
  265. /* Restore all variables describing the current status from the structure *P.
  266.    This is used after a nested function.  */
  267.  
  268. void
  269. restore_expr_status (p)
  270.      struct function *p;
  271. {
  272.   pending_stack_adjust = p->pending_stack_adjust;
  273.   inhibit_defer_pop = p->inhibit_defer_pop;
  274.   cleanups_this_call = p->cleanups_this_call;
  275.   saveregs_value = p->saveregs_value;
  276.   forced_labels = p->forced_labels;
  277. }
  278.  
  279. /* Manage the queue of increment instructions to be output
  280.    for POSTINCREMENT_EXPR expressions, etc.  */
  281.  
  282. static rtx pending_chain;
  283.  
  284. /* Queue up to increment (or change) VAR later.  BODY says how:
  285.    BODY should be the same thing you would pass to emit_insn
  286.    to increment right away.  It will go to emit_insn later on.
  287.  
  288.    The value is a QUEUED expression to be used in place of VAR
  289.    where you want to guarantee the pre-incrementation value of VAR.  */
  290.  
  291. static rtx
  292. enqueue_insn (var, body)
  293.      rtx var, body;
  294. {
  295.   pending_chain = gen_rtx (QUEUED, GET_MODE (var),
  296.                var, NULL_RTX, NULL_RTX, body, pending_chain);
  297.   return pending_chain;
  298. }
  299.  
  300. /* Use protect_from_queue to convert a QUEUED expression
  301.    into something that you can put immediately into an instruction.
  302.    If the queued incrementation has not happened yet,
  303.    protect_from_queue returns the variable itself.
  304.    If the incrementation has happened, protect_from_queue returns a temp
  305.    that contains a copy of the old value of the variable.
  306.  
  307.    Any time an rtx which might possibly be a QUEUED is to be put
  308.    into an instruction, it must be passed through protect_from_queue first.
  309.    QUEUED expressions are not meaningful in instructions.
  310.  
  311.    Do not pass a value through protect_from_queue and then hold
  312.    on to it for a while before putting it in an instruction!
  313.    If the queue is flushed in between, incorrect code will result.  */
  314.  
  315. rtx
  316. protect_from_queue (x, modify)
  317.      register rtx x;
  318.      int modify;
  319. {
  320.   register RTX_CODE code = GET_CODE (x);
  321.  
  322. #if 0  /* A QUEUED can hang around after the queue is forced out.  */
  323.   /* Shortcut for most common case.  */
  324.   if (pending_chain == 0)
  325.     return x;
  326. #endif
  327.  
  328.   if (code != QUEUED)
  329.     {
  330.       /* A special hack for read access to (MEM (QUEUED ...))
  331.      to facilitate use of autoincrement.
  332.      Make a copy of the contents of the memory location
  333.      rather than a copy of the address, but not
  334.      if the value is of mode BLKmode.  */
  335.       if (code == MEM && GET_MODE (x) != BLKmode
  336.       && GET_CODE (XEXP (x, 0)) == QUEUED && !modify)
  337.     {
  338.       register rtx y = XEXP (x, 0);
  339.       XEXP (x, 0) = QUEUED_VAR (y);
  340.       if (QUEUED_INSN (y))
  341.         {
  342.           register rtx temp = gen_reg_rtx (GET_MODE (x));
  343.           emit_insn_before (gen_move_insn (temp, x),
  344.                 QUEUED_INSN (y));
  345.           return temp;
  346.         }
  347.       return x;
  348.     }
  349.       /* Otherwise, recursively protect the subexpressions of all
  350.      the kinds of rtx's that can contain a QUEUED.  */
  351.       if (code == MEM)
  352.     XEXP (x, 0) = protect_from_queue (XEXP (x, 0), 0);
  353.       else if (code == PLUS || code == MULT)
  354.     {
  355.       XEXP (x, 0) = protect_from_queue (XEXP (x, 0), 0);
  356.       XEXP (x, 1) = protect_from_queue (XEXP (x, 1), 0);
  357.     }
  358.       return x;
  359.     }
  360.   /* If the increment has not happened, use the variable itself.  */
  361.   if (QUEUED_INSN (x) == 0)
  362.     return QUEUED_VAR (x);
  363.   /* If the increment has happened and a pre-increment copy exists,
  364.      use that copy.  */
  365.   if (QUEUED_COPY (x) != 0)
  366.     return QUEUED_COPY (x);
  367.   /* The increment has happened but we haven't set up a pre-increment copy.
  368.      Set one up now, and use it.  */
  369.   QUEUED_COPY (x) = gen_reg_rtx (GET_MODE (QUEUED_VAR (x)));
  370.   emit_insn_before (gen_move_insn (QUEUED_COPY (x), QUEUED_VAR (x)),
  371.             QUEUED_INSN (x));
  372.   return QUEUED_COPY (x);
  373. }
  374.  
  375. /* Return nonzero if X contains a QUEUED expression:
  376.    if it contains anything that will be altered by a queued increment.
  377.    We handle only combinations of MEM, PLUS, MINUS and MULT operators
  378.    since memory addresses generally contain only those.  */
  379.  
  380. static int
  381. queued_subexp_p (x)
  382.      rtx x;
  383. {
  384.   register enum rtx_code code = GET_CODE (x);
  385.   switch (code)
  386.     {
  387.     case QUEUED:
  388.       return 1;
  389.     case MEM:
  390.       return queued_subexp_p (XEXP (x, 0));
  391.     case MULT:
  392.     case PLUS:
  393.     case MINUS:
  394.       return queued_subexp_p (XEXP (x, 0))
  395.     || queued_subexp_p (XEXP (x, 1));
  396.     }
  397.   return 0;
  398. }
  399.  
  400. /* Perform all the pending incrementations.  */
  401.  
  402. void
  403. emit_queue ()
  404. {
  405.   register rtx p;
  406.   while (p = pending_chain)
  407.     {
  408.       QUEUED_INSN (p) = emit_insn (QUEUED_BODY (p));
  409.       pending_chain = QUEUED_NEXT (p);
  410.     }
  411. }
  412.  
  413. static void
  414. init_queue ()
  415. {
  416.   if (pending_chain)
  417.     abort ();
  418. }
  419.  
  420. /* Copy data from FROM to TO, where the machine modes are not the same.
  421.    Both modes may be integer, or both may be floating.
  422.    UNSIGNEDP should be nonzero if FROM is an unsigned type.
  423.    This causes zero-extension instead of sign-extension.  */
  424.  
  425. void
  426. convert_move (to, from, unsignedp)
  427.      register rtx to, from;
  428.      int unsignedp;
  429. {
  430.   enum machine_mode to_mode = GET_MODE (to);
  431.   enum machine_mode from_mode = GET_MODE (from);
  432.   int to_real = GET_MODE_CLASS (to_mode) == MODE_FLOAT;
  433.   int from_real = GET_MODE_CLASS (from_mode) == MODE_FLOAT;
  434.   enum insn_code code;
  435.   rtx libcall;
  436.  
  437.   /* rtx code for making an equivalent value.  */
  438.   enum rtx_code equiv_code = (unsignedp ? ZERO_EXTEND : SIGN_EXTEND);
  439.  
  440.   to = protect_from_queue (to, 1);
  441.   from = protect_from_queue (from, 0);
  442.  
  443.   if (to_real != from_real)
  444.     abort ();
  445.  
  446.   /* If FROM is a SUBREG that indicates that we have already done at least
  447.      the required extension, strip it.  We don't handle such SUBREGs as
  448.      TO here.  */
  449.  
  450.   if (GET_CODE (from) == SUBREG && SUBREG_PROMOTED_VAR_P (from)
  451.       && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (from)))
  452.       >= GET_MODE_SIZE (to_mode))
  453.       && SUBREG_PROMOTED_UNSIGNED_P (from) == unsignedp)
  454.     from = gen_lowpart (to_mode, from), from_mode = to_mode;
  455.  
  456.   if (GET_CODE (to) == SUBREG && SUBREG_PROMOTED_VAR_P (to))
  457.     abort ();
  458.  
  459.   if (to_mode == from_mode
  460.       || (from_mode == VOIDmode && CONSTANT_P (from)))
  461.     {
  462.       emit_move_insn (to, from);
  463.       return;
  464.     }
  465.  
  466.   if (to_real)
  467.     {
  468. #ifdef HAVE_extendsfdf2
  469.       if (HAVE_extendsfdf2 && from_mode == SFmode && to_mode == DFmode)
  470.     {
  471.       emit_unop_insn (CODE_FOR_extendsfdf2, to, from, UNKNOWN);
  472.       return;
  473.     }
  474. #endif
  475. #ifdef HAVE_extendsfxf2
  476.       if (HAVE_extendsfxf2 && from_mode == SFmode && to_mode == XFmode)
  477.     {
  478.       emit_unop_insn (CODE_FOR_extendsfxf2, to, from, UNKNOWN);
  479.       return;
  480.     }
  481. #endif
  482. #ifdef HAVE_extendsftf2
  483.       if (HAVE_extendsftf2 && from_mode == SFmode && to_mode == TFmode)
  484.     {
  485.       emit_unop_insn (CODE_FOR_extendsftf2, to, from, UNKNOWN);
  486.       return;
  487.     }
  488. #endif
  489. #ifdef HAVE_extenddfxf2
  490.       if (HAVE_extenddfxf2 && from_mode == DFmode && to_mode == XFmode)
  491.     {
  492.       emit_unop_insn (CODE_FOR_extenddfxf2, to, from, UNKNOWN);
  493.       return;
  494.     }
  495. #endif
  496. #ifdef HAVE_extenddftf2
  497.       if (HAVE_extenddftf2 && from_mode == DFmode && to_mode == TFmode)
  498.     {
  499.       emit_unop_insn (CODE_FOR_extenddftf2, to, from, UNKNOWN);
  500.       return;
  501.     }
  502. #endif
  503. #ifdef HAVE_truncdfsf2
  504.       if (HAVE_truncdfsf2 && from_mode == DFmode && to_mode == SFmode)
  505.     {
  506.       emit_unop_insn (CODE_FOR_truncdfsf2, to, from, UNKNOWN);
  507.       return;
  508.     }
  509. #endif
  510. #ifdef HAVE_truncxfsf2
  511.       if (HAVE_truncxfsf2 && from_mode == XFmode && to_mode == SFmode)
  512.     {
  513.       emit_unop_insn (CODE_FOR_truncxfsf2, to, from, UNKNOWN);
  514.       return;
  515.     }
  516. #endif
  517. #ifdef HAVE_trunctfsf2
  518.       if (HAVE_trunctfsf2 && from_mode == TFmode && to_mode == SFmode)
  519.     {
  520.       emit_unop_insn (CODE_FOR_trunctfsf2, to, from, UNKNOWN);
  521.       return;
  522.     }
  523. #endif
  524. #ifdef HAVE_truncxfdf2
  525.       if (HAVE_truncxfdf2 && from_mode == XFmode && to_mode == DFmode)
  526.     {
  527.       emit_unop_insn (CODE_FOR_truncxfdf2, to, from, UNKNOWN);
  528.       return;
  529.     }
  530. #endif
  531. #ifdef HAVE_trunctfdf2
  532.       if (HAVE_trunctfdf2 && from_mode == TFmode && to_mode == DFmode)
  533.     {
  534.       emit_unop_insn (CODE_FOR_trunctfdf2, to, from, UNKNOWN);
  535.       return;
  536.     }
  537. #endif
  538. #if defined(HAVE_extendsfxf2) && defined(HAVE_truncxfdf2)
  539.       /* Try using xf as an intermediary. */
  540.       if (HAVE_extendsfxf2 && HAVE_truncxfdf2 && from_mode == SFmode && to_mode == DFmode)
  541.     {
  542.       rtx tmp = gen_reg_rtx(XFmode);
  543.  
  544.       emit_unop_insn (CODE_FOR_extendsfxf2, tmp, from, UNKNOWN);
  545.       emit_unop_insn (CODE_FOR_truncxfdf2, to, tmp, UNKNOWN);
  546.       return;
  547.         }
  548. #endif
  549. #if defined(HAVE_extenddfxf2) && defined(HAVE_truncxfsf2)
  550.       /* Try using xf as an intermediary. */
  551.       if (HAVE_extenddfxf2 && HAVE_truncxfsf2 && from_mode == DFmode && to_mode == SFmode)
  552.     {
  553.       rtx tmp = gen_reg_rtx(XFmode);
  554.  
  555.       emit_unop_insn (CODE_FOR_extenddfxf2, tmp, from, UNKNOWN);
  556.       emit_unop_insn (CODE_FOR_truncxfsf2, to, tmp, UNKNOWN);
  557.       return;
  558.         }
  559. #endif
  560.  
  561.       libcall = (rtx) 0;
  562.       switch (from_mode)
  563.     {
  564.     case SFmode:
  565.       switch (to_mode)
  566.         {
  567.         case DFmode:
  568.           libcall = extendsfdf2_libfunc;
  569.           break;
  570.  
  571.         case XFmode:
  572.           libcall = extendsfxf2_libfunc;
  573.           break;
  574.  
  575.         case TFmode:
  576.           libcall = extendsftf2_libfunc;
  577.           break;
  578.         }
  579.       break;
  580.  
  581.     case DFmode:
  582.       switch (to_mode)
  583.         {
  584.         case SFmode:
  585.           libcall = truncdfsf2_libfunc;
  586.           break;
  587.  
  588.         case XFmode:
  589.           libcall = extenddfxf2_libfunc;
  590.           break;
  591.  
  592.         case TFmode:
  593.           libcall = extenddftf2_libfunc;
  594.           break;
  595.         }
  596.       break;
  597.  
  598.     case XFmode:
  599.       switch (to_mode)
  600.         {
  601.         case SFmode:
  602.           libcall = truncxfsf2_libfunc;
  603.           break;
  604.  
  605.         case DFmode:
  606.           libcall = truncxfdf2_libfunc;
  607.           break;
  608.         }
  609.       break;
  610.  
  611.     case TFmode:
  612.       switch (to_mode)
  613.         {
  614.         case SFmode:
  615.           libcall = trunctfsf2_libfunc;
  616.           break;
  617.  
  618.         case DFmode:
  619.           libcall = trunctfdf2_libfunc;
  620.           break;
  621.         }
  622.       break;
  623.     }
  624.  
  625.       if (libcall == (rtx) 0)
  626.     /* This conversion is not implemented yet.  */
  627.     abort ();
  628.  
  629.       emit_library_call (libcall, 1, to_mode, 1, from, from_mode);
  630.       emit_move_insn (to, hard_libcall_value (to_mode));
  631.       return;
  632.     }
  633.  
  634.   /* Now both modes are integers.  */
  635.  
  636.   /* Handle expanding beyond a word.  */
  637.   if (GET_MODE_BITSIZE (from_mode) < GET_MODE_BITSIZE (to_mode)
  638.       && GET_MODE_BITSIZE (to_mode) > BITS_PER_WORD)
  639.     {
  640.       rtx insns;
  641.       rtx lowpart;
  642.       rtx fill_value;
  643.       rtx lowfrom;
  644.       int i;
  645.       enum machine_mode lowpart_mode;
  646.       int nwords = CEIL (GET_MODE_SIZE (to_mode), UNITS_PER_WORD);
  647.  
  648.       /* Try converting directly if the insn is supported.  */
  649.       if ((code = can_extend_p (to_mode, from_mode, unsignedp))
  650.       != CODE_FOR_nothing)
  651.     {
  652.       /* If FROM is a SUBREG, put it into a register.  Do this
  653.          so that we always generate the same set of insns for
  654.          better cse'ing; if an intermediate assignment occurred,
  655.          we won't be doing the operation directly on the SUBREG.  */
  656.       if (optimize > 0 && GET_CODE (from) == SUBREG)
  657.         from = force_reg (from_mode, from);
  658.       emit_unop_insn (code, to, from, equiv_code);
  659.       return;
  660.     }
  661.       /* Next, try converting via full word.  */
  662.       else if (GET_MODE_BITSIZE (from_mode) < BITS_PER_WORD
  663.            && ((code = can_extend_p (to_mode, word_mode, unsignedp))
  664.            != CODE_FOR_nothing))
  665.     {
  666.       convert_move (gen_lowpart (word_mode, to), from, unsignedp);
  667.       emit_unop_insn (code, to,
  668.               gen_lowpart (word_mode, to), equiv_code);
  669.       return;
  670.     }
  671.  
  672.       /* No special multiword conversion insn; do it by hand.  */
  673.       start_sequence ();
  674.  
  675.       /* Get a copy of FROM widened to a word, if necessary.  */
  676.       if (GET_MODE_BITSIZE (from_mode) < BITS_PER_WORD)
  677.     lowpart_mode = word_mode;
  678.       else
  679.     lowpart_mode = from_mode;
  680.  
  681.       lowfrom = convert_to_mode (lowpart_mode, from, unsignedp);
  682.  
  683.       lowpart = gen_lowpart (lowpart_mode, to);
  684.       emit_move_insn (lowpart, lowfrom);
  685.  
  686.       /* Compute the value to put in each remaining word.  */
  687.       if (unsignedp)
  688.     fill_value = const0_rtx;
  689.       else
  690.     {
  691. #ifdef HAVE_slt
  692.       if (HAVE_slt
  693.           && insn_operand_mode[(int) CODE_FOR_slt][0] == word_mode
  694.           && STORE_FLAG_VALUE == -1)
  695.         {
  696.           emit_cmp_insn (lowfrom, const0_rtx, NE, NULL_RTX,
  697.                  lowpart_mode, 0, 0);
  698.           fill_value = gen_reg_rtx (word_mode);
  699.           emit_insn (gen_slt (fill_value));
  700.         }
  701.       else
  702. #endif
  703.         {
  704.           fill_value
  705.         = expand_shift (RSHIFT_EXPR, lowpart_mode, lowfrom,
  706.                 size_int (GET_MODE_BITSIZE (lowpart_mode) - 1),
  707.                 NULL_RTX, 0);
  708.           fill_value = convert_to_mode (word_mode, fill_value, 1);
  709.         }
  710.     }
  711.  
  712.       /* Fill the remaining words.  */
  713.       for (i = GET_MODE_SIZE (lowpart_mode) / UNITS_PER_WORD; i < nwords; i++)
  714.     {
  715.       int index = (WORDS_BIG_ENDIAN ? nwords - i - 1 : i);
  716.       rtx subword = operand_subword (to, index, 1, to_mode);
  717.  
  718.       if (subword == 0)
  719.         abort ();
  720.  
  721.       if (fill_value != subword)
  722.         emit_move_insn (subword, fill_value);
  723.     }
  724.  
  725.       insns = get_insns ();
  726.       end_sequence ();
  727.  
  728.       emit_no_conflict_block (insns, to, from, NULL_RTX,
  729.                   gen_rtx (equiv_code, to_mode, from));
  730.       return;
  731.     }
  732.  
  733.   if (GET_MODE_BITSIZE (from_mode) > BITS_PER_WORD)
  734.     {
  735.       convert_move (to, gen_lowpart (word_mode, from), 0);
  736.       return;
  737.     }
  738.  
  739.   /* Handle pointer conversion */            /* SPEE 900220 */
  740.   if (to_mode == PSImode)
  741.     {
  742.       if (from_mode != SImode)
  743.     from = convert_to_mode (SImode, from, unsignedp);
  744.  
  745. #ifdef HAVE_truncsipsi
  746.       if (HAVE_truncsipsi)
  747.     {
  748.       emit_unop_insn (CODE_FOR_truncsipsi, to, from, UNKNOWN);
  749.       return;
  750.     }
  751. #endif /* HAVE_truncsipsi */
  752.       abort ();
  753.     }
  754.  
  755.   if (from_mode == PSImode)
  756.     {
  757.       if (to_mode != SImode)
  758.     {
  759.       from = convert_to_mode (SImode, from, unsignedp);
  760.       from_mode = SImode;
  761.     }
  762.       else
  763.     {
  764. #ifdef HAVE_extendpsisi
  765.       if (HAVE_extendpsisi)
  766.         {
  767.           emit_unop_insn (CODE_FOR_extendpsisi, to, from, UNKNOWN);
  768.           return;
  769.         }
  770. #endif /* HAVE_extendpsisi */
  771.       abort ();
  772.     }
  773.     }
  774.  
  775.   /* Now follow all the conversions between integers
  776.      no more than a word long.  */
  777.  
  778.   /* For truncation, usually we can just refer to FROM in a narrower mode.  */
  779.   if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode)
  780.       && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (to_mode),
  781.                 GET_MODE_BITSIZE (from_mode))
  782.       && ((GET_CODE (from) == MEM
  783.        && ! MEM_VOLATILE_P (from)
  784.        && direct_load[(int) to_mode]
  785.        && ! mode_dependent_address_p (XEXP (from, 0)))
  786.       || GET_CODE (from) == REG
  787.       || GET_CODE (from) == SUBREG))
  788.     {
  789.       emit_move_insn (to, gen_lowpart (to_mode, from));
  790.       return;
  791.     }
  792.  
  793.   /* For truncation, usually we can just refer to FROM in a narrower mode.  */
  794.   if (GET_MODE_BITSIZE (to_mode) > GET_MODE_BITSIZE (from_mode))
  795.     {
  796.       /* Convert directly if that works.  */
  797.       if ((code = can_extend_p (to_mode, from_mode, unsignedp))
  798.       != CODE_FOR_nothing)
  799.     {
  800.       /* If FROM is a SUBREG, put it into a register.  Do this
  801.          so that we always generate the same set of insns for
  802.          better cse'ing; if an intermediate assignment occurred,
  803.          we won't be doing the operation directly on the SUBREG.  */
  804.       if (optimize > 0 && GET_CODE (from) == SUBREG)
  805.         from = force_reg (from_mode, from);
  806.       emit_unop_insn (code, to, from, equiv_code);
  807.       return;
  808.     }
  809.       else
  810.     {
  811.       enum machine_mode intermediate;
  812.  
  813.       /* Search for a mode to convert via.  */
  814.       for (intermediate = from_mode; intermediate != VOIDmode;
  815.            intermediate = GET_MODE_WIDER_MODE (intermediate))
  816.         if ((can_extend_p (to_mode, intermediate, unsignedp)
  817.          != CODE_FOR_nothing)
  818.         && (can_extend_p (intermediate, from_mode, unsignedp)
  819.             != CODE_FOR_nothing))
  820.           {
  821.         convert_move (to, convert_to_mode (intermediate, from,
  822.                            unsignedp), unsignedp);
  823.         return;
  824.           }
  825.       /* No suitable intermediate mode.  */
  826.       abort ();
  827.     }
  828.     }
  829.  
  830.   /* Support special truncate insns for certain modes.  */ 
  831.  
  832.   if (from_mode == DImode && to_mode == SImode)
  833.     {
  834. #ifdef HAVE_truncdisi2
  835.       if (HAVE_truncdisi2)
  836.     {
  837.       emit_unop_insn (CODE_FOR_truncdisi2, to, from, UNKNOWN);
  838.       return;
  839.     }
  840. #endif
  841.       convert_move (to, force_reg (from_mode, from), unsignedp);
  842.       return;
  843.     }
  844.  
  845.   if (from_mode == DImode && to_mode == HImode)
  846.     {
  847. #ifdef HAVE_truncdihi2
  848.       if (HAVE_truncdihi2)
  849.     {
  850.       emit_unop_insn (CODE_FOR_truncdihi2, to, from, UNKNOWN);
  851.       return;
  852.     }
  853. #endif
  854.       convert_move (to, force_reg (from_mode, from), unsignedp);
  855.       return;
  856.     }
  857.  
  858.   if (from_mode == DImode && to_mode == QImode)
  859.     {
  860. #ifdef HAVE_truncdiqi2
  861.       if (HAVE_truncdiqi2)
  862.     {
  863.       emit_unop_insn (CODE_FOR_truncdiqi2, to, from, UNKNOWN);
  864.       return;
  865.     }
  866. #endif
  867.       convert_move (to, force_reg (from_mode, from), unsignedp);
  868.       return;
  869.     }
  870.  
  871.   if (from_mode == SImode && to_mode == HImode)
  872.     {
  873. #ifdef HAVE_truncsihi2
  874.       if (HAVE_truncsihi2)
  875.     {
  876.       emit_unop_insn (CODE_FOR_truncsihi2, to, from, UNKNOWN);
  877.       return;
  878.     }
  879. #endif
  880.       convert_move (to, force_reg (from_mode, from), unsignedp);
  881.       return;
  882.     }
  883.  
  884.   if (from_mode == SImode && to_mode == QImode)
  885.     {
  886. #ifdef HAVE_truncsiqi2
  887.       if (HAVE_truncsiqi2)
  888.     {
  889.       emit_unop_insn (CODE_FOR_truncsiqi2, to, from, UNKNOWN);
  890.       return;
  891.     }
  892. #endif
  893.       convert_move (to, force_reg (from_mode, from), unsignedp);
  894.       return;
  895.     }
  896.  
  897.   if (from_mode == HImode && to_mode == QImode)
  898.     {
  899. #ifdef HAVE_trunchiqi2
  900.       if (HAVE_trunchiqi2)
  901.     {
  902.       emit_unop_insn (CODE_FOR_trunchiqi2, to, from, UNKNOWN);
  903.       return;
  904.     }
  905. #endif
  906.       convert_move (to, force_reg (from_mode, from), unsignedp);
  907.       return;
  908.     }
  909.  
  910.   /* Handle truncation of volatile memrefs, and so on;
  911.      the things that couldn't be truncated directly,
  912.      and for which there was no special instruction.  */
  913.   if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode))
  914.     {
  915.       rtx temp = force_reg (to_mode, gen_lowpart (to_mode, from));
  916.       emit_move_insn (to, temp);
  917.       return;
  918.     }
  919.  
  920. #if defined(APPLE_HAX) && defined(PTR_HACK)
  921.  
  922.   if (from_mode == TPmode && to_mode == DPmode)
  923.     {
  924. #ifdef HAVE_convertTPDP2
  925.       if (HAVE_convertTPDP2)
  926.     {
  927.       emit_unop_insn (CODE_FOR_convertTPDP2, to, from, UNKNOWN);
  928.       return;
  929.     }
  930. #endif
  931.       abort ();
  932.     }
  933.  
  934.   if (from_mode == DPmode && to_mode == TPmode)
  935.     {
  936. #ifdef HAVE_convertDPTP2
  937.       if (HAVE_convertDPTP2)
  938.     {
  939.       emit_unop_insn (CODE_FOR_convertDPTP2, to, from, UNKNOWN);
  940.       return;
  941.     }
  942. #endif
  943.       abort ();
  944.     }
  945.  
  946.   if (from_mode == DPmode && to_mode == SImode)
  947.     {
  948. #ifdef HAVE_convertDPsi2
  949.       if (HAVE_convertDPsi2)
  950.     {
  951.       emit_unop_insn (CODE_FOR_convertDPsi2, to, from, UNKNOWN);
  952.       return;
  953.     }
  954. #endif
  955.       abort ();
  956.     }
  957.  
  958.   if (from_mode == SImode && to_mode == DPmode)
  959.     {
  960. #ifdef HAVE_convertsiDP2
  961.       if (HAVE_convertsiDP2)
  962.     {
  963.       emit_unop_insn (CODE_FOR_convertsiDP2, to, from, UNKNOWN);
  964.       return;
  965.     }
  966. #endif
  967.       abort ();
  968.     }
  969.  
  970.   if (from_mode == TPmode && to_mode == SImode)
  971.     {
  972. #ifdef HAVE_convertTPsi2
  973.       if (HAVE_convertTPsi2)
  974.     {
  975.       emit_unop_insn (CODE_FOR_convertTPsi2, to, from, UNKNOWN);
  976.       return;
  977.     }
  978. #endif
  979.       abort ();
  980.     }
  981.  
  982.   if (from_mode == SImode && to_mode == TPmode)
  983.     {
  984. #ifdef HAVE_convertsiTP2
  985.       if (HAVE_convertsiTP2)
  986.     {
  987.       emit_unop_insn (CODE_FOR_convertsiTP2, to, from, UNKNOWN);
  988.       return;
  989.     }
  990. #endif
  991.       abort ();
  992.     }
  993.  
  994. #endif /* APPLE_HAX */
  995.  
  996.   /* Mode combination is not recognized.  */
  997.   abort ();
  998. }
  999.  
  1000. /* Return an rtx for a value that would result
  1001.    from converting X to mode MODE.
  1002.    Both X and MODE may be floating, or both integer.
  1003.    UNSIGNEDP is nonzero if X is an unsigned value.
  1004.    This can be done by referring to a part of X in place
  1005.    or by copying to a new temporary with conversion.
  1006.  
  1007.    This function *must not* call protect_from_queue
  1008.    except when putting X into an insn (in which case convert_move does it).  */
  1009.  
  1010. rtx
  1011. convert_to_mode (mode, x, unsignedp)
  1012.      enum machine_mode mode;
  1013.      rtx x;
  1014.      int unsignedp;
  1015. {
  1016.   register rtx temp;
  1017.  
  1018.   /* If FROM is a SUBREG that indicates that we have already done at least
  1019.      the required extension, strip it.  */
  1020.  
  1021.   if (GET_CODE (x) == SUBREG && SUBREG_PROMOTED_VAR_P (x)
  1022.       && GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) >= GET_MODE_SIZE (mode)
  1023.       && SUBREG_PROMOTED_UNSIGNED_P (x) == unsignedp)
  1024.     x = gen_lowpart (mode, x);
  1025.  
  1026.   if (mode == GET_MODE (x))
  1027.     return x;
  1028.  
  1029.   /* There is one case that we must handle specially: If we are converting
  1030.      a CONST_INT into a mode whose size is twice HOST_BITS_PER_WIDE_INT and
  1031.      we are to interpret the constant as unsigned, gen_lowpart will do
  1032.      the wrong if the constant appears negative.  What we want to do is
  1033.      make the high-order word of the constant zero, not all ones.  */
  1034.  
  1035.   if (unsignedp && GET_MODE_CLASS (mode) == MODE_INT
  1036.       && GET_MODE_BITSIZE (mode) == 2 * HOST_BITS_PER_WIDE_INT
  1037.       && GET_CODE (x) == CONST_INT && INTVAL (x) < 0)
  1038.     return immed_double_const (INTVAL (x), (HOST_WIDE_INT) 0, mode);
  1039.  
  1040.   /* We can do this with a gen_lowpart if both desired and current modes
  1041.      are integer, and this is either a constant integer, a register, or a
  1042.      non-volatile MEM.  Except for the constant case, we must be narrowing
  1043.      the operand.  */
  1044.  
  1045.   if (GET_CODE (x) == CONST_INT
  1046.       || (GET_MODE_CLASS (mode) == MODE_INT
  1047.       && GET_MODE_CLASS (GET_MODE (x)) == MODE_INT
  1048.       && (GET_CODE (x) == CONST_DOUBLE
  1049.           || (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (x))
  1050.           && ((GET_CODE (x) == MEM && ! MEM_VOLATILE_P (x))
  1051.               && direct_load[(int) mode]
  1052.               || GET_CODE (x) == REG)))))
  1053.     return gen_lowpart (mode, x);
  1054.  
  1055.   temp = gen_reg_rtx (mode);
  1056.   convert_move (temp, x, unsignedp);
  1057.   return temp;
  1058. }
  1059.  
  1060. /* Generate several move instructions to copy LEN bytes
  1061.    from block FROM to block TO.  (These are MEM rtx's with BLKmode).
  1062.    The caller must pass FROM and TO
  1063.     through protect_from_queue before calling.
  1064.    ALIGN (in bytes) is maximum alignment we can assume.  */
  1065.  
  1066. struct move_by_pieces
  1067. {
  1068.   rtx to;
  1069.   rtx to_addr;
  1070.   int autinc_to;
  1071.   int explicit_inc_to;
  1072.   rtx from;
  1073.   rtx from_addr;
  1074.   int autinc_from;
  1075.   int explicit_inc_from;
  1076.   int len;
  1077.   int offset;
  1078.   int reverse;
  1079. };
  1080.  
  1081. static void move_by_pieces_1 ();
  1082. static int move_by_pieces_ninsns ();
  1083.  
  1084. static void
  1085. move_by_pieces (to, from, len, align)
  1086.      rtx to, from;
  1087.      int len, align;
  1088. {
  1089.   struct move_by_pieces data;
  1090.   rtx to_addr = XEXP (to, 0), from_addr = XEXP (from, 0);
  1091.   int max_size = MOVE_MAX + 1;
  1092.  
  1093.   data.offset = 0;
  1094.   data.to_addr = to_addr;
  1095.   data.from_addr = from_addr;
  1096.   data.to = to;
  1097.   data.from = from;
  1098.   data.autinc_to
  1099.     = (GET_CODE (to_addr) == PRE_INC || GET_CODE (to_addr) == PRE_DEC
  1100.        || GET_CODE (to_addr) == POST_INC || GET_CODE (to_addr) == POST_DEC);
  1101.   data.autinc_from
  1102.     = (GET_CODE (from_addr) == PRE_INC || GET_CODE (from_addr) == PRE_DEC
  1103.        || GET_CODE (from_addr) == POST_INC
  1104.        || GET_CODE (from_addr) == POST_DEC);
  1105.  
  1106.   data.explicit_inc_from = 0;
  1107.   data.explicit_inc_to = 0;
  1108.   data.reverse
  1109.     = (GET_CODE (to_addr) == PRE_DEC || GET_CODE (to_addr) == POST_DEC);
  1110.   if (data.reverse) data.offset = len;
  1111.   data.len = len;
  1112.  
  1113.   /* If copying requires more than two move insns,
  1114.      copy addresses to registers (to make displacements shorter)
  1115.      and use post-increment if available.  */
  1116.   if (!(data.autinc_from && data.autinc_to)
  1117.       && move_by_pieces_ninsns (len, align) > 2)
  1118.     {
  1119. #ifdef HAVE_PRE_DECREMENT
  1120.       if (data.reverse && ! data.autinc_from)
  1121.     {
  1122.       data.from_addr = copy_addr_to_reg (plus_constant (from_addr, len));
  1123.       data.autinc_from = 1;
  1124.       data.explicit_inc_from = -1;
  1125.     }
  1126. #endif
  1127. #ifdef HAVE_POST_INCREMENT
  1128.       if (! data.autinc_from)
  1129.     {
  1130.       data.from_addr = copy_addr_to_reg (from_addr);
  1131.       data.autinc_from = 1;
  1132.       data.explicit_inc_from = 1;
  1133.     }
  1134. #endif
  1135.       if (!data.autinc_from && CONSTANT_P (from_addr))
  1136.     data.from_addr = copy_addr_to_reg (from_addr);
  1137. #ifdef HAVE_PRE_DECREMENT
  1138.       if (data.reverse && ! data.autinc_to)
  1139.     {
  1140.       data.to_addr = copy_addr_to_reg (plus_constant (to_addr, len));
  1141.       data.autinc_to = 1;
  1142.       data.explicit_inc_to = -1;
  1143.     }
  1144. #endif
  1145. #ifdef HAVE_POST_INCREMENT
  1146.       if (! data.reverse && ! data.autinc_to)
  1147.     {
  1148.       data.to_addr = copy_addr_to_reg (to_addr);
  1149.       data.autinc_to = 1;
  1150.       data.explicit_inc_to = 1;
  1151.     }
  1152. #endif
  1153.       if (!data.autinc_to && CONSTANT_P (to_addr))
  1154.     data.to_addr = copy_addr_to_reg (to_addr);
  1155.     }
  1156.  
  1157.   if (! (STRICT_ALIGNMENT || SLOW_UNALIGNED_ACCESS)
  1158.       || align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
  1159.     align = MOVE_MAX;
  1160.  
  1161.   /* First move what we can in the largest integer mode, then go to
  1162.      successively smaller modes.  */
  1163.  
  1164.   while (max_size > 1)
  1165.     {
  1166.       enum machine_mode mode = VOIDmode, tmode;
  1167.       enum insn_code icode;
  1168.  
  1169.       for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
  1170.        tmode != VOIDmode; tmode = GET_MODE_WIDER_MODE (tmode))
  1171.     if (GET_MODE_SIZE (tmode) < max_size)
  1172.       mode = tmode;
  1173.  
  1174.       if (mode == VOIDmode)
  1175.     break;
  1176.  
  1177.       icode = mov_optab->handlers[(int) mode].insn_code;
  1178.       if (icode != CODE_FOR_nothing
  1179.       && align >= MIN (BIGGEST_ALIGNMENT / BITS_PER_UNIT,
  1180.                GET_MODE_SIZE (mode)))
  1181.     move_by_pieces_1 (GEN_FCN (icode), mode, &data);
  1182.  
  1183.       max_size = GET_MODE_SIZE (mode);
  1184.     }
  1185.  
  1186.   /* The code above should have handled everything.  */
  1187.   if (data.len != 0)
  1188.     abort ();
  1189. }
  1190.  
  1191. /* Return number of insns required to move L bytes by pieces.
  1192.    ALIGN (in bytes) is maximum alignment we can assume.  */
  1193.  
  1194. static int
  1195. move_by_pieces_ninsns (l, align)
  1196.      unsigned int l;
  1197.      int align;
  1198. {
  1199.   register int n_insns = 0;
  1200.   int max_size = MOVE_MAX + 1;
  1201.  
  1202.   if (! (STRICT_ALIGNMENT || SLOW_UNALIGNED_ACCESS)
  1203.       || align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
  1204.     align = MOVE_MAX;
  1205.  
  1206.   while (max_size > 1)
  1207.     {
  1208.       enum machine_mode mode = VOIDmode, tmode;
  1209.       enum insn_code icode;
  1210.  
  1211.       for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
  1212.        tmode != VOIDmode; tmode = GET_MODE_WIDER_MODE (tmode))
  1213.     if (GET_MODE_SIZE (tmode) < max_size)
  1214.       mode = tmode;
  1215.  
  1216.       if (mode == VOIDmode)
  1217.     break;
  1218.  
  1219.       icode = mov_optab->handlers[(int) mode].insn_code;
  1220.       if (icode != CODE_FOR_nothing
  1221.       && align >= MIN (BIGGEST_ALIGNMENT / BITS_PER_UNIT,
  1222.                GET_MODE_SIZE (mode)))
  1223.     n_insns += l / GET_MODE_SIZE (mode), l %= GET_MODE_SIZE (mode);
  1224.  
  1225.       max_size = GET_MODE_SIZE (mode);
  1226.     }
  1227.  
  1228.   return n_insns;
  1229. }
  1230.  
  1231. /* Subroutine of move_by_pieces.  Move as many bytes as appropriate
  1232.    with move instructions for mode MODE.  GENFUN is the gen_... function
  1233.    to make a move insn for that mode.  DATA has all the other info.  */
  1234.  
  1235. static void
  1236. move_by_pieces_1 (genfun, mode, data)
  1237.      rtx (*genfun) ();
  1238.      enum machine_mode mode;
  1239.      struct move_by_pieces *data;
  1240. {
  1241.   register int size = GET_MODE_SIZE (mode);
  1242.   register rtx to1, from1;
  1243.  
  1244.   while (data->len >= size)
  1245.     {
  1246.       if (data->reverse) data->offset -= size;
  1247.  
  1248.       to1 = (data->autinc_to
  1249.          ? gen_rtx (MEM, mode, data->to_addr)
  1250.          : change_address (data->to, mode,
  1251.                    plus_constant (data->to_addr, data->offset)));
  1252.       from1 =
  1253.     (data->autinc_from
  1254.      ? gen_rtx (MEM, mode, data->from_addr)
  1255.      : change_address (data->from, mode,
  1256.                plus_constant (data->from_addr, data->offset)));
  1257.  
  1258. #ifdef HAVE_PRE_DECREMENT
  1259.       if (data->explicit_inc_to < 0)
  1260.     emit_insn (gen_add2_insn (data->to_addr, GEN_INT (-size)));
  1261.       if (data->explicit_inc_from < 0)
  1262.     emit_insn (gen_add2_insn (data->from_addr, GEN_INT (-size)));
  1263. #endif
  1264.  
  1265.       emit_insn ((*genfun) (to1, from1));
  1266. #ifdef HAVE_POST_INCREMENT
  1267.       if (data->explicit_inc_to > 0)
  1268.     emit_insn (gen_add2_insn (data->to_addr, GEN_INT (size)));
  1269.       if (data->explicit_inc_from > 0)
  1270.     emit_insn (gen_add2_insn (data->from_addr, GEN_INT (size)));
  1271. #endif
  1272.  
  1273.       if (! data->reverse) data->offset += size;
  1274.  
  1275.       data->len -= size;
  1276.     }
  1277. }
  1278.  
  1279. /* Emit code to move a block Y to a block X.
  1280.    This may be done with string-move instructions,
  1281.    with multiple scalar move instructions, or with a library call.
  1282.  
  1283.    Both X and Y must be MEM rtx's (perhaps inside VOLATILE)
  1284.    with mode BLKmode.
  1285.    SIZE is an rtx that says how long they are.
  1286.    ALIGN is the maximum alignment we can assume they have,
  1287.    measured in bytes.  */
  1288.  
  1289. void
  1290. emit_block_move (x, y, size, align)
  1291.      rtx x, y;
  1292.      rtx size;
  1293.      int align;
  1294. {
  1295.   if (GET_MODE (x) != BLKmode)
  1296.     abort ();
  1297.  
  1298.   if (GET_MODE (y) != BLKmode)
  1299.     abort ();
  1300.  
  1301.   x = protect_from_queue (x, 1);
  1302.   y = protect_from_queue (y, 0);
  1303.   size = protect_from_queue (size, 0);
  1304.  
  1305.   if (GET_CODE (x) != MEM)
  1306.     abort ();
  1307.   if (GET_CODE (y) != MEM)
  1308.     abort ();
  1309.   if (size == 0)
  1310.     abort ();
  1311.  
  1312.   if (GET_CODE (size) == CONST_INT
  1313.       && (move_by_pieces_ninsns (INTVAL (size), align) < MOVE_RATIO))
  1314.     move_by_pieces (x, y, INTVAL (size), align);
  1315.   else
  1316.     {
  1317.       /* Try the most limited insn first, because there's no point
  1318.      including more than one in the machine description unless
  1319.      the more limited one has some advantage.  */
  1320.  
  1321.       rtx opalign = GEN_INT (align);
  1322.       enum machine_mode mode;
  1323.  
  1324.       for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
  1325.        mode = GET_MODE_WIDER_MODE (mode))
  1326.     {
  1327.       enum insn_code code = movstr_optab[(int) mode];
  1328.  
  1329.       if (code != CODE_FOR_nothing
  1330.           /* We don't need MODE to be narrower than BITS_PER_HOST_WIDE_INT
  1331.          here because if SIZE is less than the mode mask, as it is
  1332.          returned by the macro, it will definately be less than the
  1333.          actual mode mask.  */
  1334.           && (unsigned) INTVAL (size) <= GET_MODE_MASK (mode)
  1335.           && (insn_operand_predicate[(int) code][0] == 0
  1336.           || (*insn_operand_predicate[(int) code][0]) (x, BLKmode))
  1337.           && (insn_operand_predicate[(int) code][1] == 0
  1338.           || (*insn_operand_predicate[(int) code][1]) (y, BLKmode))
  1339.           && (insn_operand_predicate[(int) code][3] == 0
  1340.           || (*insn_operand_predicate[(int) code][3]) (opalign,
  1341.                                    VOIDmode)))
  1342.         {
  1343.           rtx op2;
  1344.           rtx last = get_last_insn ();
  1345.           rtx pat;
  1346.  
  1347.           op2 = convert_to_mode (mode, size, 1);
  1348.           if (insn_operand_predicate[(int) code][2] != 0
  1349.           && ! (*insn_operand_predicate[(int) code][2]) (op2, mode))
  1350.         op2 = copy_to_mode_reg (mode, op2);
  1351.  
  1352.           pat = GEN_FCN ((int) code) (x, y, op2, opalign);
  1353.           if (pat)
  1354.         {
  1355.           emit_insn (pat);
  1356.           return;
  1357.         }
  1358.           else
  1359.         delete_insns_since (last);
  1360.         }
  1361.     }
  1362.  
  1363. #ifdef TARGET_MEM_FUNCTIONS
  1364.       emit_library_call (memcpy_libfunc, 0,
  1365.              VOIDmode, 3, XEXP (x, 0), DPmode,
  1366.              XEXP (y, 0), DPmode,
  1367.              convert_to_mode (SImode, size, 1), SImode);
  1368. #else
  1369.       emit_library_call (bcopy_libfunc, 0,
  1370.              VOIDmode, 3, XEXP (y, 0), Pmode,
  1371.              XEXP (x, 0), Pmode,
  1372.              convert_to_mode (Pmode, size, 1), Pmode);
  1373. #endif
  1374.     }
  1375. }
  1376.  
  1377. /* Copy all or part of a value X into registers starting at REGNO.
  1378.    The number of registers to be filled is NREGS.  */
  1379.  
  1380. void
  1381. move_block_to_reg (regno, x, nregs, mode)
  1382.      int regno;
  1383.      rtx x;
  1384.      int nregs;
  1385.      enum machine_mode mode;
  1386. {
  1387.   int i;
  1388.   rtx pat, last;
  1389.  
  1390.   if (CONSTANT_P (x) && ! LEGITIMATE_CONSTANT_P (x))
  1391.     x = validize_mem (force_const_mem (mode, x));
  1392.  
  1393.   /* See if the machine can do this with a load multiple insn.  */
  1394. #ifdef HAVE_load_multiple
  1395.   last = get_last_insn ();
  1396.   pat = gen_load_multiple (gen_rtx (REG, word_mode, regno), x,
  1397.                GEN_INT (nregs));
  1398.   if (pat)
  1399.     {
  1400.       emit_insn (pat);
  1401.       return;
  1402.     }
  1403.   else
  1404.     delete_insns_since (last);
  1405. #endif
  1406.  
  1407.   for (i = 0; i < nregs; i++)
  1408.     emit_move_insn (gen_rtx (REG, word_mode, regno + i),
  1409.             operand_subword_force (x, i, mode));
  1410. }
  1411.  
  1412. /* Copy all or part of a BLKmode value X out of registers starting at REGNO.
  1413.    The number of registers to be filled is NREGS.  */
  1414.  
  1415. void
  1416. move_block_from_reg (regno, x, nregs)
  1417.      int regno;
  1418.      rtx x;
  1419.      int nregs;
  1420. {
  1421.   int i;
  1422.   rtx pat, last;
  1423.  
  1424.   /* See if the machine can do this with a store multiple insn.  */
  1425. #ifdef HAVE_store_multiple
  1426.   last = get_last_insn ();
  1427.   pat = gen_store_multiple (x, gen_rtx (REG, word_mode, regno),
  1428.                 GEN_INT (nregs));
  1429.   if (pat)
  1430.     {
  1431.       emit_insn (pat);
  1432.       return;
  1433.     }
  1434.   else
  1435.     delete_insns_since (last);
  1436. #endif
  1437.  
  1438.   for (i = 0; i < nregs; i++)
  1439.     {
  1440.       rtx tem = operand_subword (x, i, 1, BLKmode);
  1441.  
  1442.       if (tem == 0)
  1443.     abort ();
  1444.  
  1445.       emit_move_insn (tem, gen_rtx (REG, word_mode, regno + i));
  1446.     }
  1447. }
  1448.  
  1449. /* Mark NREGS consecutive regs, starting at REGNO, as being live now.  */
  1450.  
  1451. void
  1452. use_regs (regno, nregs)
  1453.      int regno;
  1454.      int nregs;
  1455. {
  1456.   int i;
  1457.  
  1458.   for (i = 0; i < nregs; i++)
  1459.     emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, word_mode, regno + i)));
  1460. }
  1461.  
  1462. /* Mark the instructions since PREV as a libcall block.
  1463.    Add REG_LIBCALL to PREV and add a REG_RETVAL to the most recent insn.  */
  1464.  
  1465. static rtx
  1466. group_insns (prev)
  1467.      rtx prev;
  1468. {
  1469.   rtx insn_first;
  1470.   rtx insn_last;
  1471.  
  1472.   /* Find the instructions to mark */
  1473.   if (prev)
  1474.     insn_first = NEXT_INSN (prev);
  1475.   else
  1476.     insn_first = get_insns ();
  1477.  
  1478.   insn_last = get_last_insn ();
  1479.  
  1480.   REG_NOTES (insn_last) = gen_rtx (INSN_LIST, REG_RETVAL, insn_first,
  1481.                    REG_NOTES (insn_last));
  1482.  
  1483.   REG_NOTES (insn_first) = gen_rtx (INSN_LIST, REG_LIBCALL, insn_last,
  1484.                     REG_NOTES (insn_first));
  1485. }
  1486.  
  1487. /* Write zeros through the storage of OBJECT.
  1488.    If OBJECT has BLKmode, SIZE is its length in bytes.  */
  1489.  
  1490. void
  1491. clear_storage (object, size)
  1492.      rtx object;
  1493.      int size;
  1494. {
  1495.   if (GET_MODE (object) == BLKmode)
  1496.     {
  1497. #ifdef TARGET_MEM_FUNCTIONS
  1498.       emit_library_call (memset_libfunc, 0,
  1499.              VOIDmode, 3,
  1500.              XEXP (object, 0), DPmode, const0_rtx, DPmode,
  1501.              GEN_INT (size), DPmode);
  1502. #else
  1503.       emit_library_call (bzero_libfunc, 0,
  1504.              VOIDmode, 2,
  1505.              XEXP (object, 0), Pmode,
  1506.              GEN_INT (size), Pmode);
  1507. #endif
  1508.     }
  1509.   else
  1510.     emit_move_insn (object, const0_rtx);
  1511. }
  1512.  
  1513. /* Generate code to copy Y into X.
  1514.    Both Y and X must have the same mode, except that
  1515.    Y can be a constant with VOIDmode.
  1516.    This mode cannot be BLKmode; use emit_block_move for that.
  1517.  
  1518.    Return the last instruction emitted.  */
  1519.  
  1520. rtx
  1521. emit_move_insn (x, y)
  1522.      rtx x, y;
  1523. {
  1524.   enum machine_mode mode = GET_MODE (x);
  1525.   enum machine_mode submode;
  1526.   enum mode_class class = GET_MODE_CLASS (mode);
  1527.   int i;
  1528.  
  1529.   x = protect_from_queue (x, 1);
  1530.   y = protect_from_queue (y, 0);
  1531.  
  1532.   if (mode == BLKmode || (GET_MODE (y) != mode && GET_MODE (y) != VOIDmode))
  1533.     { debug_rtx(x); debug_rtx(y); abort(); }
  1534.   if (CONSTANT_P (y) && ! LEGITIMATE_CONSTANT_P (y))
  1535.     y = force_const_mem (mode, y);
  1536.  
  1537.   /* If X or Y are memory references, verify that their addresses are valid
  1538.      for the machine.  */
  1539.   if (GET_CODE (x) == MEM
  1540.       && ((! memory_address_p (GET_MODE (x), XEXP (x, 0))
  1541.        && ! push_operand (x, GET_MODE (x)))
  1542.       || (flag_force_addr
  1543.           && CONSTANT_ADDRESS_P (XEXP (x, 0)))))
  1544.     x = change_address (x, VOIDmode, XEXP (x, 0));
  1545.  
  1546.   if (GET_CODE (y) == MEM
  1547.       && (! memory_address_p (GET_MODE (y), XEXP (y, 0))
  1548.       || (flag_force_addr
  1549.           && CONSTANT_ADDRESS_P (XEXP (y, 0)))))
  1550.     y = change_address (y, VOIDmode, XEXP (y, 0));
  1551.  
  1552.   if (mode == BLKmode)
  1553.     abort ();
  1554.  
  1555.   if (class == MODE_COMPLEX_FLOAT || class == MODE_COMPLEX_INT)
  1556.     submode = mode_for_size (GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT,
  1557.                  (class == MODE_COMPLEX_INT
  1558.                   ? MODE_INT : MODE_FLOAT),
  1559.                  0);
  1560.  
  1561.   if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  1562.     return
  1563.       emit_insn (GEN_FCN (mov_optab->handlers[(int) mode].insn_code) (x, y));
  1564.  
  1565.   /* Expand complex moves by moving real part and imag part, if posible.  */
  1566.   else if ((class == MODE_COMPLEX_FLOAT || class == MODE_COMPLEX_INT)
  1567.        && submode != BLKmode
  1568.        && (mov_optab->handlers[(int) submode].insn_code
  1569.            != CODE_FOR_nothing))
  1570.     {
  1571.       /* Don't split destination if it is a stack push.  */
  1572.       int stack = push_operand (x, GET_MODE (x));
  1573.       rtx prev = get_last_insn ();
  1574.  
  1575.       /* Tell flow that the whole of the destination is being set.  */
  1576.       if (GET_CODE (x) == REG)
  1577.     emit_insn (gen_rtx (CLOBBER, VOIDmode, x));
  1578.  
  1579.       /* If this is a stack, push the highpart first, so it
  1580.      will be in the argument order.
  1581.  
  1582.      In that case, change_address is used only to convert
  1583.      the mode, not to change the address.  */
  1584.       emit_insn (GEN_FCN (mov_optab->handlers[(int) submode].insn_code)
  1585.          ((stack ? change_address (x, submode, (rtx) 0)
  1586.            : gen_highpart (submode, x)),
  1587.           gen_highpart (submode, y)));
  1588.       emit_insn (GEN_FCN (mov_optab->handlers[(int) submode].insn_code)
  1589.          ((stack ? change_address (x, submode, (rtx) 0)
  1590.            : gen_lowpart (submode, x)),
  1591.           gen_lowpart (submode, y)));
  1592.  
  1593.       group_insns (prev);
  1594.  
  1595.       return get_last_insn ();
  1596.     }
  1597.  
  1598.   /* This will handle any multi-word mode that lacks a move_insn pattern.
  1599.      However, you will get better code if you define such patterns,
  1600.      even if they must turn into multiple assembler instructions.  */
  1601.   else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
  1602.     {
  1603.       rtx last_insn = 0;
  1604.       rtx prev_insn = get_last_insn ();
  1605.  
  1606.       for (i = 0;
  1607.        i < (GET_MODE_SIZE (mode)  + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
  1608.        i++)
  1609.     {
  1610.       rtx xpart = operand_subword (x, i, 1, mode);
  1611.       rtx ypart = operand_subword (y, i, 1, mode);
  1612.  
  1613.       /* If we can't get a part of Y, put Y into memory if it is a
  1614.          constant.  Otherwise, force it into a register.  If we still
  1615.          can't get a part of Y, abort.  */
  1616.       if (ypart == 0 && CONSTANT_P (y))
  1617.         {
  1618.           y = force_const_mem (mode, y);
  1619.           ypart = operand_subword (y, i, 1, mode);
  1620.         }
  1621.       else if (ypart == 0)
  1622.         ypart = operand_subword_force (y, i, mode);
  1623.  
  1624.       if (xpart == 0 || ypart == 0)
  1625.         abort ();
  1626.  
  1627.       last_insn = emit_move_insn (xpart, ypart);
  1628.     }
  1629.       /* Mark these insns as a libcall block.  */
  1630.       group_insns (prev_insn);
  1631.  
  1632.       return last_insn;
  1633.     }
  1634.   else
  1635.     abort ();
  1636. }
  1637.  
  1638. /* Pushing data onto the stack.  */
  1639.  
  1640. /* Push a block of length SIZE (perhaps variable)
  1641.    and return an rtx to address the beginning of the block.
  1642.    Note that it is not possible for the value returned to be a QUEUED.
  1643.    The value may be virtual_outgoing_args_rtx.
  1644.  
  1645.    EXTRA is the number of bytes of padding to push in addition to SIZE.
  1646.    BELOW nonzero means this padding comes at low addresses;
  1647.    otherwise, the padding comes at high addresses.  */
  1648.  
  1649. rtx
  1650. push_block (size, extra, below)
  1651.      rtx size;
  1652.      int extra, below;
  1653. {
  1654.   register rtx temp;
  1655.   if (CONSTANT_P (size))
  1656.     anti_adjust_stack (plus_constant (size, extra));
  1657.   else if (GET_CODE (size) == REG && extra == 0)
  1658.     anti_adjust_stack (size);
  1659.   else
  1660.     {
  1661.       rtx temp = copy_to_mode_reg (DPmode, size);
  1662.       if (extra != 0)
  1663.     temp = expand_binop (DPmode, add_optab, temp, GEN_INT (extra),
  1664.                  temp, 0, OPTAB_LIB_WIDEN);
  1665.       anti_adjust_stack (temp);
  1666.     }
  1667.  
  1668. #ifdef STACK_GROWS_DOWNWARD
  1669.   temp = virtual_outgoing_args_rtx;
  1670.   if (extra != 0 && below)
  1671.     temp = plus_constant (temp, extra);
  1672. #else
  1673.   if (GET_CODE (size) == CONST_INT)
  1674.     temp = plus_constant (virtual_outgoing_args_rtx,
  1675.               - INTVAL (size) - (below ? 0 : extra));
  1676.   else if (extra != 0 && !below)
  1677.     temp = gen_rtx (PLUS, DPmode, virtual_outgoing_args_rtx,
  1678.             negate_rtx (DPmode, plus_constant (size, extra)));
  1679.   else
  1680.     temp = gen_rtx (PLUS, DPmode, virtual_outgoing_args_rtx,
  1681.             negate_rtx (DPmode, size));
  1682. #endif
  1683.  
  1684.   return memory_address (GET_CLASS_NARROWEST_MODE (MODE_INT), temp);
  1685. }
  1686.  
  1687. rtx
  1688. gen_push_operand ()
  1689. {
  1690.   return gen_rtx (STACK_PUSH_CODE, DPmode, stack_pointer_rtx);
  1691. }
  1692.  
  1693. /* Generate code to push X onto the stack, assuming it has mode MODE and
  1694.    type TYPE.
  1695.    MODE is redundant except when X is a CONST_INT (since they don't
  1696.    carry mode info).
  1697.    SIZE is an rtx for the size of data to be copied (in bytes),
  1698.    needed only if X is BLKmode.
  1699.  
  1700.    ALIGN (in bytes) is maximum alignment we can assume.
  1701.  
  1702.    If PARTIAL is nonzero, then copy that many of the first words
  1703.    of X into registers starting with REG, and push the rest of X.
  1704.    The amount of space pushed is decreased by PARTIAL words,
  1705.    rounded *down* to a multiple of PARM_BOUNDARY.
  1706.    REG must be a hard register in this case.
  1707.  
  1708.    EXTRA is the amount in bytes of extra space to leave next to this arg.
  1709.    This is ignored if an argument block has already been allocated.
  1710.  
  1711.    On a machine that lacks real push insns, ARGS_ADDR is the address of
  1712.    the bottom of the argument block for this call.  We use indexing off there
  1713.    to store the arg.  On machines with push insns, ARGS_ADDR is 0 when a
  1714.    argument block has not been preallocated.
  1715.  
  1716.    ARGS_SO_FAR is the size of args previously pushed for this call.  */
  1717.  
  1718. void
  1719. emit_push_insn (x, mode, type, size, align, partial, reg, extra,
  1720.         args_addr, args_so_far)
  1721.      register rtx x;
  1722.      enum machine_mode mode;
  1723.      tree type;
  1724.      rtx size;
  1725.      int align;
  1726.      int partial;
  1727.      rtx reg;
  1728.      int extra;
  1729.      rtx args_addr;
  1730.      rtx args_so_far;
  1731. {
  1732.   rtx xinner;
  1733.   enum direction stack_direction
  1734. #ifdef STACK_GROWS_DOWNWARD
  1735.     = downward;
  1736. #else
  1737.     = upward;
  1738. #endif
  1739.  
  1740.   /* Decide where to pad the argument: `downward' for below,
  1741.      `upward' for above, or `none' for don't pad it.
  1742.      Default is below for small data on big-endian machines; else above.  */
  1743.   enum direction where_pad = FUNCTION_ARG_PADDING (mode, type);
  1744.  
  1745.   /* Invert direction if stack is post-update.  */
  1746.   if (STACK_PUSH_CODE == POST_INC || STACK_PUSH_CODE == POST_DEC)
  1747.     if (where_pad != none)
  1748.       where_pad = (where_pad == downward ? upward : downward);
  1749.  
  1750.   xinner = x = protect_from_queue (x, 0);
  1751.  
  1752.   if (mode == BLKmode)
  1753.     {
  1754.       /* Copy a block into the stack, entirely or partially.  */
  1755.  
  1756.       register rtx temp;
  1757.       int used = partial * UNITS_PER_WORD;
  1758.       int offset = used % (PARM_BOUNDARY / BITS_PER_UNIT);
  1759.       int skip;
  1760.       
  1761.       if (size == 0)
  1762.     abort ();
  1763.  
  1764.       used -= offset;
  1765.  
  1766.       /* USED is now the # of bytes we need not copy to the stack
  1767.      because registers will take care of them.  */
  1768.  
  1769.       if (partial != 0)
  1770.     xinner = change_address (xinner, BLKmode,
  1771.                  plus_constant (XEXP (xinner, 0), used));
  1772.  
  1773.       /* If the partial register-part of the arg counts in its stack size,
  1774.      skip the part of stack space corresponding to the registers.
  1775.      Otherwise, start copying to the beginning of the stack space,
  1776.      by setting SKIP to 0.  */
  1777. #ifndef REG_PARM_STACK_SPACE
  1778.       skip = 0;
  1779. #else
  1780.       skip = used;
  1781. #endif
  1782.  
  1783. #ifdef PUSH_ROUNDING
  1784.       /* Do it with several push insns if that doesn't take lots of insns
  1785.      and if there is no difficulty with push insns that skip bytes
  1786.      on the stack for alignment purposes.  */
  1787.       if (args_addr == 0
  1788.       && GET_CODE (size) == CONST_INT
  1789.       && skip == 0
  1790.       && (move_by_pieces_ninsns ((unsigned) INTVAL (size) - used, align)
  1791.           < MOVE_RATIO)
  1792.       /* Here we avoid the case of a structure whose weak alignment
  1793.          forces many pushes of a small amount of data,
  1794.          and such small pushes do rounding that causes trouble.  */
  1795.       && ((! STRICT_ALIGNMENT && ! SLOW_UNALIGNED_ACCESS)
  1796.           || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT
  1797.           || PUSH_ROUNDING (align) == align)
  1798.       && PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
  1799.     {
  1800.       /* Push padding now if padding above and stack grows down,
  1801.          or if padding below and stack grows up.
  1802.          But if space already allocated, this has already been done.  */
  1803.       if (extra && args_addr == 0
  1804.           && where_pad != none && where_pad != stack_direction)
  1805.         anti_adjust_stack (GEN_INT (extra));
  1806.  
  1807.       move_by_pieces (gen_rtx (MEM, BLKmode, gen_push_operand ()), xinner,
  1808.               INTVAL (size) - used, align);
  1809.     }
  1810.       else
  1811. #endif /* PUSH_ROUNDING */
  1812.     {
  1813.       /* Otherwise make space on the stack and copy the data
  1814.          to the address of that space.  */
  1815.  
  1816.       /* Deduct words put into registers from the size we must copy.  */
  1817.       if (partial != 0)
  1818.         {
  1819.           if (GET_CODE (size) == CONST_INT)
  1820.         size = GEN_INT (INTVAL (size) - used);
  1821.           else
  1822.         size = expand_binop (GET_MODE (size), sub_optab, size,
  1823.                      GEN_INT (used), NULL_RTX, 0,
  1824.                      OPTAB_LIB_WIDEN);
  1825.         }
  1826.  
  1827.       /* Get the address of the stack space.
  1828.          In this case, we do not deal with EXTRA separately.
  1829.          A single stack adjust will do.  */
  1830.       if (! args_addr)
  1831.         {
  1832.           temp = push_block (size, extra, where_pad == downward);
  1833.           extra = 0;
  1834.         }
  1835.       else if (GET_CODE (args_so_far) == CONST_INT)
  1836.         temp = memory_address (BLKmode,
  1837.                    plus_constant (args_addr,
  1838.                           skip + INTVAL (args_so_far)));
  1839.       else
  1840.         temp = memory_address (BLKmode,
  1841.                    plus_constant (gen_rtx (PLUS, DPmode,
  1842.                                args_addr, args_so_far),
  1843.                           skip));
  1844.  
  1845.       /* TEMP is the address of the block.  Copy the data there.  */
  1846.       if (GET_CODE (size) == CONST_INT
  1847.           && (move_by_pieces_ninsns ((unsigned) INTVAL (size), align)
  1848.           < MOVE_RATIO))
  1849.         {
  1850.           move_by_pieces (gen_rtx (MEM, BLKmode, temp), xinner,
  1851.                   INTVAL (size), align);
  1852.           goto ret;
  1853.         }
  1854.       /* Try the most limited insn first, because there's no point
  1855.          including more than one in the machine description unless
  1856.          the more limited one has some advantage.  */
  1857. #ifdef HAVE_movstrqi
  1858.       if (HAVE_movstrqi
  1859.           && GET_CODE (size) == CONST_INT
  1860.           && ((unsigned) INTVAL (size)
  1861.           < (1 << (GET_MODE_BITSIZE (QImode) - 1))))
  1862.         {
  1863.           emit_insn (gen_movstrqi (gen_rtx (MEM, BLKmode, temp),
  1864.                        xinner, size, GEN_INT (align)));
  1865.           goto ret;
  1866.         }
  1867. #endif
  1868. #ifdef HAVE_movstrhi
  1869.       if (HAVE_movstrhi
  1870.           && GET_CODE (size) == CONST_INT
  1871.           && ((unsigned) INTVAL (size)
  1872.           < (1 << (GET_MODE_BITSIZE (HImode) - 1))))
  1873.         {
  1874.           emit_insn (gen_movstrhi (gen_rtx (MEM, BLKmode, temp),
  1875.                        xinner, size, GEN_INT (align)));
  1876.           goto ret;
  1877.         }
  1878. #endif
  1879. #ifdef HAVE_movstrsi
  1880.       if (HAVE_movstrsi)
  1881.         {
  1882.           emit_insn (gen_movstrsi (gen_rtx (MEM, BLKmode, temp),
  1883.                        xinner, size, GEN_INT (align)));
  1884.           goto ret;
  1885.         }
  1886. #endif
  1887. #ifdef HAVE_movstrdi
  1888.       if (HAVE_movstrdi)
  1889.         {
  1890.           emit_insn (gen_movstrdi (gen_rtx (MEM, BLKmode, temp),
  1891.                        xinner, size, GEN_INT (align)));
  1892.           goto ret;
  1893.         }
  1894. #endif
  1895.  
  1896. #ifndef ACCUMULATE_OUTGOING_ARGS
  1897.       /* If the source is referenced relative to the stack pointer,
  1898.          copy it to another register to stabilize it.  We do not need
  1899.          to do this if we know that we won't be changing sp.  */
  1900.  
  1901.       if (reg_mentioned_p (virtual_stack_dynamic_rtx, temp)
  1902.           || reg_mentioned_p (virtual_outgoing_args_rtx, temp))
  1903.         temp = copy_to_reg (temp);
  1904. #endif
  1905.  
  1906.       /* Make inhibit_defer_pop nonzero around the library call
  1907.          to force it to pop the bcopy-arguments right away.  */
  1908.       NO_DEFER_POP;
  1909. #ifdef TARGET_MEM_FUNCTIONS
  1910.       emit_library_call (memcpy_libfunc, 0,
  1911.                  VOIDmode, 3, temp, DPmode, XEXP (xinner, 0), DPmode,
  1912.                  size, DPmode);
  1913. #else
  1914.       emit_library_call (bcopy_libfunc, 0,
  1915.                  VOIDmode, 3, XEXP (xinner, 0), Pmode, temp, Pmode,
  1916.                  size, Pmode);
  1917. #endif
  1918.       OK_DEFER_POP;
  1919.     }
  1920.     }
  1921.   else if (partial > 0)
  1922.     {
  1923.       /* Scalar partly in registers.  */
  1924.  
  1925.       int size = GET_MODE_SIZE (mode) / UNITS_PER_WORD;
  1926.       int i;
  1927.       int not_stack;
  1928.       /* # words of start of argument
  1929.      that we must make space for but need not store.  */
  1930.       int offset = partial % (PARM_BOUNDARY / BITS_PER_WORD);
  1931.       int args_offset = INTVAL (args_so_far);
  1932.       int skip;
  1933.  
  1934.       /* Push padding now if padding above and stack grows down,
  1935.      or if padding below and stack grows up.
  1936.      But if space already allocated, this has already been done.  */
  1937.       if (extra && args_addr == 0
  1938.       && where_pad != none && where_pad != stack_direction)
  1939.     anti_adjust_stack (GEN_INT (extra));
  1940.  
  1941.       /* If we make space by pushing it, we might as well push
  1942.      the real data.  Otherwise, we can leave OFFSET nonzero
  1943.      and leave the space uninitialized.  */
  1944.       if (args_addr == 0)
  1945.     offset = 0;
  1946.  
  1947.       /* Now NOT_STACK gets the number of words that we don't need to
  1948.      allocate on the stack.  */
  1949.       not_stack = partial - offset;
  1950.  
  1951.       /* If the partial register-part of the arg counts in its stack size,
  1952.      skip the part of stack space corresponding to the registers.
  1953.      Otherwise, start copying to the beginning of the stack space,
  1954.      by setting SKIP to 0.  */
  1955. #ifndef REG_PARM_STACK_SPACE
  1956.       skip = 0;
  1957. #else
  1958.       skip = not_stack;
  1959. #endif
  1960.  
  1961.       if (CONSTANT_P (x) && ! LEGITIMATE_CONSTANT_P (x))
  1962.     x = validize_mem (force_const_mem (mode, x));
  1963.  
  1964.       /* If X is a hard register in a non-integer mode, copy it into a pseudo;
  1965.      SUBREGs of such registers are not allowed.  */
  1966.       if ((GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER
  1967.        && GET_MODE_CLASS (GET_MODE (x)) != MODE_INT))
  1968.     x = copy_to_reg (x);
  1969.  
  1970.       /* Loop over all the words allocated on the stack for this arg.  */
  1971.       /* We can do it by words, because any scalar bigger than a word
  1972.      has a size a multiple of a word.  */
  1973. #ifndef PUSH_ARGS_REVERSED
  1974.       for (i = not_stack; i < size; i++)
  1975. #else
  1976.       for (i = size - 1; i >= not_stack; i--)
  1977. #endif
  1978.     if (i >= not_stack + offset)
  1979.       emit_push_insn (operand_subword_force (x, i, mode),
  1980.               word_mode, NULL_TREE, NULL_RTX, align, 0, NULL_RTX,
  1981.               0, args_addr,
  1982.               GEN_INT (args_offset + ((i - not_stack + skip)
  1983.                           * UNITS_PER_WORD)));
  1984.     }
  1985.   else
  1986.     {
  1987.       rtx addr;
  1988.  
  1989.       /* Push padding now if padding above and stack grows down,
  1990.      or if padding below and stack grows up.
  1991.      But if space already allocated, this has already been done.  */
  1992.       if (extra && args_addr == 0
  1993.       && where_pad != none && where_pad != stack_direction)
  1994.     anti_adjust_stack (GEN_INT (extra));
  1995.  
  1996. #ifdef PUSH_ROUNDING
  1997.       if (args_addr == 0)
  1998.     addr = gen_push_operand ();
  1999.       else
  2000. #endif
  2001.     if (GET_CODE (args_so_far) == CONST_INT)
  2002.       addr
  2003.         = memory_address (mode,
  2004.                   plus_constant (args_addr, INTVAL (args_so_far)));
  2005.       else
  2006.     addr = memory_address (mode, gen_rtx (PLUS, DPmode, args_addr,
  2007.                           args_so_far));
  2008.  
  2009.       emit_move_insn (gen_rtx (MEM, mode, addr), x);
  2010.     }
  2011.  
  2012.  ret:
  2013.   /* If part should go in registers, copy that part
  2014.      into the appropriate registers.  Do this now, at the end,
  2015.      since mem-to-mem copies above may do function calls.  */
  2016.   if (partial > 0)
  2017.     move_block_to_reg (REGNO (reg), x, partial, mode);
  2018.  
  2019.   if (extra && args_addr == 0 && where_pad == stack_direction)
  2020.     anti_adjust_stack (GEN_INT (extra));
  2021. }
  2022.  
  2023. /* Output a library call to function FUN (a SYMBOL_REF rtx)
  2024.    (emitting the queue unless NO_QUEUE is nonzero),
  2025.    for a value of mode OUTMODE,
  2026.    with NARGS different arguments, passed as alternating rtx values
  2027.    and machine_modes to convert them to.
  2028.    The rtx values should have been passed through protect_from_queue already.
  2029.  
  2030.    NO_QUEUE will be true if and only if the library call is a `const' call
  2031.    which will be enclosed in REG_LIBCALL/REG_RETVAL notes; it is equivalent
  2032.    to the variable is_const in expand_call.
  2033.  
  2034.    NO_QUEUE must be true for const calls, because if it isn't, then
  2035.    any pending increment will be emitted between REG_LIBCALL/REG_RETVAL notes,
  2036.    and will be lost if the libcall sequence is optimized away.
  2037.  
  2038.    NO_QUEUE must be false for non-const calls, because if it isn't, the
  2039.    call insn will have its CONST_CALL_P bit set, and it will be incorrectly
  2040.    optimized.  For instance, the instruction scheduler may incorrectly
  2041.    move memory references across the non-const call.  */
  2042.  
  2043. void
  2044. emit_library_call (va_alist)
  2045.      va_dcl
  2046. {
  2047.   va_list p;
  2048.   struct args_size args_size;
  2049.   register int argnum;
  2050.   enum machine_mode outmode;
  2051.   int nargs;
  2052.   rtx fun;
  2053.   rtx orgfun;
  2054.   int inc;
  2055.   int count;
  2056.   rtx argblock = 0;
  2057.   CUMULATIVE_ARGS args_so_far;
  2058.   struct arg { rtx value; enum machine_mode mode; rtx reg; int partial;
  2059.            struct args_size offset; struct args_size size; };
  2060.   struct arg *argvec;
  2061.   int old_inhibit_defer_pop = inhibit_defer_pop;
  2062.   int no_queue = 0;
  2063.   rtx use_insns;
  2064.  
  2065.   va_start (p);
  2066.   orgfun = fun = va_arg (p, rtx);
  2067.   no_queue = va_arg (p, int);
  2068.   outmode = va_arg (p, enum machine_mode);
  2069.   nargs = va_arg (p, int);
  2070.  
  2071. #ifdef MPW_ASM
  2072.   import_a_function(XSTR (orgfun, 0), 0);
  2073. #endif
  2074.  
  2075.   /* Copy all the libcall-arguments out of the varargs data
  2076.      and into a vector ARGVEC.
  2077.  
  2078.      Compute how to pass each argument.  We only support a very small subset
  2079.      of the full argument passing conventions to limit complexity here since
  2080.      library functions shouldn't have many args.  */
  2081.  
  2082.   argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
  2083.  
  2084.   /* "fun" was changed to NULL by MPW_PP - why? */
  2085.   INIT_CUMULATIVE_ARGS (args_so_far, (tree)0, fun);
  2086.  
  2087.   args_size.constant = 0;
  2088.   args_size.var = 0;
  2089.  
  2090.   for (count = 0; count < nargs; count++)
  2091.     {
  2092.       rtx val = va_arg (p, rtx);
  2093.       enum machine_mode mode = va_arg (p, enum machine_mode);
  2094.  
  2095.       /* We cannot convert the arg value to the mode the library wants here;
  2096.      must do it earlier where we know the signedness of the arg.  */
  2097.       if (mode == BLKmode
  2098.       || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode))
  2099.     abort ();
  2100.  
  2101.       /* On some machines, there's no way to pass a float to a library fcn.
  2102.      Pass it as a double instead.  */
  2103. #ifdef LIBGCC_NEEDS_DOUBLE
  2104.       if (LIBGCC_NEEDS_DOUBLE && mode == SFmode)
  2105.     val = convert_to_mode (DFmode, val, 0), mode = DFmode;
  2106. #endif
  2107.  
  2108.       /* There's no need to call protect_from_queue, because
  2109.      either emit_move_insn or emit_push_insn will do that.  */
  2110.  
  2111.       /* Make sure it is a reasonable operand for a move or push insn.  */
  2112.       if (GET_CODE (val) != REG && GET_CODE (val) != MEM
  2113.       && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val)))
  2114.     val = force_operand (val, NULL_RTX);
  2115.  
  2116.       argvec[count].value = val;
  2117.       argvec[count].mode = mode;
  2118.  
  2119. #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
  2120.       if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1))
  2121.     abort ();
  2122. #endif
  2123.  
  2124.       argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
  2125.       if (argvec[count].reg && GET_CODE (argvec[count].reg) == EXPR_LIST)
  2126.     abort ();
  2127. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  2128.       argvec[count].partial
  2129.     = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1);
  2130. #else
  2131.       argvec[count].partial = 0;
  2132. #endif
  2133.  
  2134.       locate_and_pad_parm (mode, NULL_TREE,
  2135.                argvec[count].reg && argvec[count].partial == 0,
  2136.                NULL_TREE, &args_size, &argvec[count].offset,
  2137.                &argvec[count].size);
  2138.  
  2139.       if (argvec[count].size.var)
  2140.     abort ();
  2141.  
  2142. #ifndef REG_PARM_STACK_SPACE
  2143.       if (argvec[count].partial)
  2144.     argvec[count].size.constant -= argvec[count].partial * UNITS_PER_WORD;
  2145. #endif
  2146.  
  2147.       if (argvec[count].reg == 0 || argvec[count].partial != 0
  2148. #ifdef REG_PARM_STACK_SPACE
  2149.       || 1
  2150. #endif
  2151.       )
  2152.     args_size.constant += argvec[count].size.constant;
  2153.  
  2154. #ifdef ACCUMULATE_OUTGOING_ARGS
  2155.       /* If this arg is actually passed on the stack, it might be
  2156.      clobbering something we already put there (this library call might
  2157.      be inside the evaluation of an argument to a function whose call
  2158.      requires the stack).  This will only occur when the library call
  2159.      has sufficient args to run out of argument registers.  Abort in
  2160.      this case; if this ever occurs, code must be added to save and
  2161.      restore the arg slot.  */
  2162.  
  2163.       if (argvec[count].reg == 0 || argvec[count].partial != 0)
  2164.     abort ();
  2165. #endif
  2166.  
  2167.       FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree)0, 1);
  2168.     }
  2169.   va_end (p);
  2170.  
  2171.   /* If this machine requires an external definition for library
  2172.      functions, write one out.  */
  2173.   assemble_external_libcall (fun);
  2174.  
  2175. #ifdef STACK_BOUNDARY
  2176.   args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
  2177.              / STACK_BYTES) * STACK_BYTES);
  2178. #endif
  2179.  
  2180. #ifdef REG_PARM_STACK_SPACE
  2181.   args_size.constant = MAX (args_size.constant,
  2182.                 REG_PARM_STACK_SPACE ((tree) 0));
  2183. #endif
  2184.  
  2185. #ifdef ACCUMULATE_OUTGOING_ARGS
  2186.   if (args_size.constant > current_function_outgoing_args_size)
  2187.     current_function_outgoing_args_size = args_size.constant;
  2188.   args_size.constant = 0;
  2189. #endif
  2190.  
  2191. #ifndef PUSH_ROUNDING
  2192.   argblock = push_block (GEN_INT (args_size.constant), 0, 0);
  2193. #endif
  2194.  
  2195. #ifdef PUSH_ARGS_REVERSED
  2196.   inc = -1;
  2197.   argnum = nargs - 1;
  2198. #else
  2199.   inc = 1;
  2200.   argnum = 0;
  2201. #endif
  2202.  
  2203.   /* Push the args that need to be pushed.  */
  2204.  
  2205.   for (count = 0; count < nargs; count++, argnum += inc)
  2206.     {
  2207.       register enum machine_mode mode = argvec[argnum].mode;
  2208.       register rtx val = argvec[argnum].value;
  2209.       rtx reg = argvec[argnum].reg;
  2210.       int partial = argvec[argnum].partial;
  2211.  
  2212.       if (! (reg != 0 && partial == 0))
  2213.     emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
  2214.             argblock, GEN_INT (argvec[count].offset.constant));
  2215.       NO_DEFER_POP;
  2216.     }
  2217.  
  2218. #ifdef PUSH_ARGS_REVERSED
  2219.   argnum = nargs - 1;
  2220. #else
  2221.   argnum = 0;
  2222. #endif
  2223.  
  2224.   /* Now load any reg parms into their regs.  */
  2225.  
  2226.   for (count = 0; count < nargs; count++, argnum += inc)
  2227.     {
  2228.       register enum machine_mode mode = argvec[argnum].mode;
  2229.       register rtx val = argvec[argnum].value;
  2230.       rtx reg = argvec[argnum].reg;
  2231.       int partial = argvec[argnum].partial;
  2232.  
  2233.       if (reg != 0 && partial == 0)
  2234.     emit_move_insn (reg, val);
  2235.       NO_DEFER_POP;
  2236.     }
  2237.  
  2238.   /* For version 1.37, try deleting this entirely.  */
  2239.   if (! no_queue)
  2240.     emit_queue ();
  2241.  
  2242.   /* Any regs containing parms remain in use through the call.  */
  2243.   start_sequence ();
  2244.   for (count = 0; count < nargs; count++)
  2245.     if (argvec[count].reg != 0)
  2246.       emit_insn (gen_rtx (USE, VOIDmode, argvec[count].reg));
  2247.  
  2248.   use_insns = get_insns ();
  2249.   end_sequence ();
  2250.  
  2251.   fun = prepare_call_address (fun, NULL_TREE, &use_insns);
  2252.  
  2253.   /* Don't allow popping to be deferred, since then
  2254.      cse'ing of library calls could delete a call and leave the pop.  */
  2255.   NO_DEFER_POP;
  2256.  
  2257.   /* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which
  2258.      will set inhibit_defer_pop to that value.  */
  2259.  
  2260.   emit_call_1 (fun, get_identifier (XSTR (orgfun, 0)), args_size.constant, 0,
  2261.            FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
  2262.            outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX,
  2263.            old_inhibit_defer_pop + 1, use_insns, no_queue,
  2264.            /* Supply default values for the extra parameters.
  2265.               These values are based on the assumption that library calls
  2266.           are never pascal-declared. */
  2267.            FALSE, VOIDmode, 0);
  2268.  
  2269.   /* Now restore inhibit_defer_pop to its actual original value.  */
  2270.   OK_DEFER_POP;
  2271. }
  2272.  
  2273. /* Expand an assignment that stores the value of FROM into TO.
  2274.    If WANT_VALUE is nonzero, return an rtx for the value of TO.
  2275.    (This may contain a QUEUED rtx.)
  2276.    Otherwise, the returned value is not meaningful.
  2277.  
  2278.    SUGGEST_REG is no longer actually used.
  2279.    It used to mean, copy the value through a register
  2280.    and return that register, if that is possible.
  2281.    But now we do this if WANT_VALUE.
  2282.  
  2283.    If the value stored is a constant, we return the constant.  */
  2284.  
  2285. rtx
  2286. expand_assignment (to, from, want_value, suggest_reg)
  2287.      tree to, from;
  2288.      int want_value;
  2289.      int suggest_reg;
  2290. {
  2291.   register rtx to_rtx = 0;
  2292.   rtx result;
  2293.  
  2294.   /* Don't crash if the lhs of the assignment was erroneous.  */
  2295.  
  2296.   if (TREE_CODE (to) == ERROR_MARK)
  2297.     return expand_expr (from, NULL_RTX, VOIDmode, 0);
  2298.  
  2299.   /* Assignment of a structure component needs special treatment
  2300.      if the structure component's rtx is not simply a MEM.
  2301.      Assignment of an array element at a constant index
  2302.      has the same problem.  */
  2303.  
  2304.   if (TREE_CODE (to) == COMPONENT_REF
  2305.       || TREE_CODE (to) == BIT_FIELD_REF
  2306.       || (TREE_CODE (to) == ARRAY_REF
  2307.       && TREE_CODE (TREE_OPERAND (to, 1)) == INTEGER_CST
  2308.       && TREE_CODE (TYPE_SIZE (TREE_TYPE (to))) == INTEGER_CST))
  2309.     {
  2310.       enum machine_mode mode1;
  2311.       int bitsize;
  2312.       int bitpos;
  2313.       tree offset;
  2314.       int unsignedp;
  2315.       int volatilep = 0;
  2316.       tree tem = get_inner_reference (to, &bitsize, &bitpos, &offset,
  2317.                       &mode1, &unsignedp, &volatilep);
  2318.  
  2319.       /* If we are going to use store_bit_field and extract_bit_field,
  2320.      make sure to_rtx will be safe for multiple use.  */
  2321.  
  2322.       if (mode1 == VOIDmode && want_value)
  2323.     tem = stabilize_reference (tem);
  2324.  
  2325.       to_rtx = expand_expr (tem, NULL_RTX, VOIDmode, 0);
  2326.       if (offset != 0)
  2327.     {
  2328.       rtx offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, 0);
  2329.  
  2330.       if (GET_CODE (to_rtx) != MEM)
  2331.         abort ();
  2332.       to_rtx = change_address (to_rtx, VOIDmode,
  2333.                    gen_rtx (PLUS, DPmode, XEXP (to_rtx, 0),
  2334.                         force_reg (DPmode, offset_rtx)));
  2335.     }
  2336.       if (volatilep)
  2337.     {
  2338.       if (GET_CODE (to_rtx) == MEM)
  2339.         MEM_VOLATILE_P (to_rtx) = 1;
  2340. #if 0  /* This was turned off because, when a field is volatile
  2341.       in an object which is not volatile, the object may be in a register,
  2342.       and then we would abort over here.  */
  2343.       else
  2344.         abort ();
  2345. #endif
  2346.     }
  2347.  
  2348.       result = store_field (to_rtx, bitsize, bitpos, mode1, from,
  2349.                 (want_value
  2350.                  /* Spurious cast makes HPUX compiler happy.  */
  2351.                  ? (enum machine_mode) TYPE_MODE (TREE_TYPE (to))
  2352.                  : VOIDmode),
  2353.                 unsignedp,
  2354.                 /* Required alignment of containing datum.  */
  2355.                 TYPE_ALIGN (TREE_TYPE (tem)) / BITS_PER_UNIT,
  2356.                 int_size_in_bytes (TREE_TYPE (tem)));
  2357.       preserve_temp_slots (result);
  2358.       free_temp_slots ();
  2359.  
  2360.       return result;
  2361.     }
  2362.  
  2363.   /* Ordinary treatment.  Expand TO to get a REG or MEM rtx.
  2364.      Don't re-expand if it was expanded already (in COMPONENT_REF case).  */
  2365.  
  2366.   if (to_rtx == 0)
  2367.     to_rtx = expand_expr (to, NULL_RTX, VOIDmode, 0);
  2368.  
  2369.   /* In case we are returning the contents of an object which overlaps
  2370.      the place the value is being stored, use a safe function when copying
  2371.      a value through a pointer into a structure value return block.  */
  2372.   if (TREE_CODE (to) == RESULT_DECL && TREE_CODE (from) == INDIRECT_REF
  2373.       && current_function_returns_struct
  2374.       && !current_function_returns_pcc_struct)
  2375.     {
  2376.       rtx from_rtx = expand_expr (from, NULL_RTX, VOIDmode, 0);
  2377.       rtx size = expr_size (from);
  2378.  
  2379. #ifdef TARGET_MEM_FUNCTIONS
  2380.       emit_library_call (memcpy_libfunc, 0,
  2381.              VOIDmode, 3, XEXP (to_rtx, 0), DPmode,
  2382.              XEXP (from_rtx, 0), DPmode,
  2383.              size, DPmode);
  2384. #else
  2385.       emit_library_call (bcopy_libfunc, 0,
  2386.              VOIDmode, 3, XEXP (from_rtx, 0), Pmode,
  2387.              XEXP (to_rtx, 0), Pmode,
  2388.              size, Pmode);
  2389. #endif
  2390.  
  2391.       preserve_temp_slots (to_rtx);
  2392.       free_temp_slots ();
  2393.       return to_rtx;
  2394.     }
  2395.  
  2396.   /* Compute FROM and store the value in the rtx we got.  */
  2397.  
  2398.   result = store_expr (from, to_rtx, want_value);
  2399.   preserve_temp_slots (result);
  2400.   free_temp_slots ();
  2401.   return result;
  2402. }
  2403.  
  2404. /* Generate code for computing expression EXP,
  2405.    and storing the value into TARGET.
  2406.    Returns TARGET or an equivalent value.
  2407.    TARGET may contain a QUEUED rtx.
  2408.  
  2409.    If SUGGEST_REG is nonzero, copy the value through a register
  2410.    and return that register, if that is possible.
  2411.  
  2412.    If the value stored is a constant, we return the constant.  */
  2413.  
  2414. rtx
  2415. store_expr (exp, target, suggest_reg)
  2416.      register tree exp;
  2417.      register rtx target;
  2418.      int suggest_reg;
  2419. {
  2420.   register rtx temp;
  2421.   int dont_return_target = 0;
  2422.  
  2423.   if (TREE_CODE (exp) == COMPOUND_EXPR)
  2424.     {
  2425.       /* Perform first part of compound expression, then assign from second
  2426.      part.  */
  2427.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
  2428.       emit_queue ();
  2429.       return store_expr (TREE_OPERAND (exp, 1), target, suggest_reg);
  2430.     }
  2431.   else if (TREE_CODE (exp) == COND_EXPR && GET_MODE (target) == BLKmode)
  2432.     {
  2433.       /* For conditional expression, get safe form of the target.  Then
  2434.      test the condition, doing the appropriate assignment on either
  2435.      side.  This avoids the creation of unnecessary temporaries.
  2436.      For non-BLKmode, it is more efficient not to do this.  */
  2437.  
  2438.       rtx lab1 = gen_label_rtx (), lab2 = gen_label_rtx ();
  2439.  
  2440.       emit_queue ();
  2441.       target = protect_from_queue (target, 1);
  2442.  
  2443.       NO_DEFER_POP;
  2444.       jumpifnot (TREE_OPERAND (exp, 0), lab1);
  2445.       store_expr (TREE_OPERAND (exp, 1), target, suggest_reg);
  2446.       emit_queue ();
  2447.       emit_jump_insn (gen_jump (lab2));
  2448.       emit_barrier ();
  2449.       emit_label (lab1);
  2450.       store_expr (TREE_OPERAND (exp, 2), target, suggest_reg);
  2451.       emit_queue ();
  2452.       emit_label (lab2);
  2453.       OK_DEFER_POP;
  2454.       return target;
  2455.     }
  2456.   else if (suggest_reg && GET_CODE (target) == MEM
  2457.        && GET_MODE (target) != BLKmode)
  2458.     /* If target is in memory and caller wants value in a register instead,
  2459.        arrange that.  Pass TARGET as target for expand_expr so that,
  2460.        if EXP is another assignment, SUGGEST_REG will be nonzero for it.
  2461.        We know expand_expr will not use the target in that case.  */
  2462.     {
  2463.       temp = expand_expr (exp, cse_not_expected ? NULL_RTX : target,
  2464.               GET_MODE (target), 0);
  2465.       if (GET_MODE (temp) != BLKmode && GET_MODE (temp) != VOIDmode)
  2466.     temp = copy_to_reg (temp);
  2467.       dont_return_target = 1;
  2468.     }
  2469.   else if (queued_subexp_p (target))
  2470.     /* If target contains a postincrement, it is not safe
  2471.        to use as the returned value.  It would access the wrong
  2472.        place by the time the queued increment gets output.
  2473.        So copy the value through a temporary and use that temp
  2474.        as the result.  */
  2475.     {
  2476.       if (GET_MODE (target) != BLKmode && GET_MODE (target) != VOIDmode)
  2477.     {
  2478.       /* Expand EXP into a new pseudo.  */
  2479.       temp = gen_reg_rtx (GET_MODE (target));
  2480.       temp = expand_expr (exp, temp, GET_MODE (target), 0);
  2481.     }
  2482.       else
  2483.     temp = expand_expr (exp, NULL_RTX, GET_MODE (target), 0);
  2484.       dont_return_target = 1;
  2485.     }
  2486.   else if (GET_CODE (target) == SUBREG && SUBREG_PROMOTED_VAR_P (target))
  2487.     /* If this is an scalar in a register that is stored in a wider mode
  2488.        than the declared mode, compute the result into its declared mode
  2489.        and then convert to the wider mode.  Our value is the computed
  2490.        expression.  */
  2491.     {
  2492.       temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);
  2493.       convert_move (SUBREG_REG (target), temp,
  2494.             SUBREG_PROMOTED_UNSIGNED_P (target));
  2495.       return temp;
  2496.     }
  2497.   else
  2498.     {
  2499.       temp = expand_expr (exp, target, GET_MODE (target), 0);
  2500.       /* DO return TARGET if it's a specified hardware register.
  2501.      expand_return relies on this.  */
  2502.       if (!(target && GET_CODE (target) == REG
  2503.         && REGNO (target) < FIRST_PSEUDO_REGISTER)
  2504.       && CONSTANT_P (temp))
  2505.     dont_return_target = 1;
  2506.     }
  2507.  
  2508.   /* If value was not generated in the target, store it there.
  2509.      Convert the value to TARGET's type first if nec.  */
  2510.  
  2511.   if (temp != target && TREE_CODE (exp) != ERROR_MARK)
  2512.     {
  2513.       target = protect_from_queue (target, 1);
  2514.       if (GET_MODE (temp) != GET_MODE (target)
  2515.       && GET_MODE (temp) != VOIDmode)
  2516.     {
  2517.       int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  2518.       if (dont_return_target)
  2519.         {
  2520.           /* In this case, we will return TEMP,
  2521.          so make sure it has the proper mode.
  2522.          But don't forget to store the value into TARGET.  */
  2523.           temp = convert_to_mode (GET_MODE (target), temp, unsignedp);
  2524.           emit_move_insn (target, temp);
  2525.         }
  2526.       else
  2527.         convert_move (target, temp, unsignedp);
  2528.     }
  2529.  
  2530.       else if (GET_MODE (temp) == BLKmode && TREE_CODE (exp) == STRING_CST)
  2531.     {
  2532.       /* Handle copying a string constant into an array.
  2533.          The string constant may be shorter than the array.
  2534.          So copy just the string's actual length, and clear the rest.  */
  2535.       rtx size;
  2536.  
  2537.       /* Get the size of the data type of the string,
  2538.          which is actually the size of the target.  */
  2539.       size = expr_size (exp);
  2540.       if (GET_CODE (size) == CONST_INT
  2541.           && INTVAL (size) < TREE_STRING_LENGTH (exp))
  2542.         emit_block_move (target, temp, size,
  2543.                  TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  2544.       else
  2545.         {
  2546.           /* Compute the size of the data to copy from the string.  */
  2547.           tree copy_size
  2548.         = fold (build (MIN_EXPR, sizetype,
  2549.                    size_binop (CEIL_DIV_EXPR,
  2550.                        TYPE_SIZE (TREE_TYPE (exp)),
  2551.                        size_int (BITS_PER_UNIT)),
  2552.                    convert (sizetype,
  2553.                     build_int_2 (TREE_STRING_LENGTH (exp), 0))));
  2554.           rtx copy_size_rtx = expand_expr (copy_size, NULL_RTX,
  2555.                            VOIDmode, 0);
  2556.           rtx label = 0;
  2557.  
  2558.           /* Copy that much.  */
  2559.           emit_block_move (target, temp, copy_size_rtx,
  2560.                    TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  2561.  
  2562.           /* Figure out how much is left in TARGET
  2563.          that we have to clear.  */
  2564.           if (GET_CODE (copy_size_rtx) == CONST_INT)
  2565.         {
  2566.           temp = plus_constant (XEXP (target, 0),
  2567.                     TREE_STRING_LENGTH (exp));
  2568.           size = plus_constant (size,
  2569.                     - TREE_STRING_LENGTH (exp));
  2570.         }
  2571.           else
  2572.         {
  2573.           enum machine_mode size_mode = DPmode;
  2574.  
  2575.           temp = force_reg (DPmode, XEXP (target, 0));
  2576.           temp = expand_binop (size_mode, add_optab, temp,
  2577.                        copy_size_rtx, NULL_RTX, 0,
  2578.                        OPTAB_LIB_WIDEN);
  2579.  
  2580.           size = expand_binop (size_mode, sub_optab, size,
  2581.                        copy_size_rtx, NULL_RTX, 0,
  2582.                        OPTAB_LIB_WIDEN);
  2583.  
  2584.           emit_cmp_insn (size, const0_rtx, LT, NULL_RTX,
  2585.                  GET_MODE (size), 0, 0);
  2586.           label = gen_label_rtx ();
  2587.           emit_jump_insn (gen_blt (label));
  2588.         }
  2589.  
  2590.           if (size != const0_rtx)
  2591.         {
  2592. #ifdef TARGET_MEM_FUNCTIONS
  2593.           emit_library_call (memset_libfunc, 0, VOIDmode, 3,
  2594.                      temp, DPmode, const0_rtx, DPmode, size, DPmode);
  2595. #else
  2596.           emit_library_call (bzero_libfunc, 0, VOIDmode, 2,
  2597.                      temp, Pmode, size, Pmode);
  2598. #endif
  2599.         }
  2600.           if (label)
  2601.         emit_label (label);
  2602.         }
  2603.     }
  2604.       else if (GET_MODE (temp) == BLKmode)
  2605.     emit_block_move (target, temp, expr_size (exp),
  2606.              TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  2607.       else
  2608.     emit_move_insn (target, temp);
  2609.     }
  2610.   if (dont_return_target)
  2611.     return temp;
  2612.   return target;
  2613. }
  2614.  
  2615. /* Store the value of constructor EXP into the rtx TARGET.
  2616.    TARGET is either a REG or a MEM.  */
  2617.  
  2618. static void
  2619. store_constructor (exp, target)
  2620.      tree exp;
  2621.      rtx target;
  2622. {
  2623.   tree type = TREE_TYPE (exp);
  2624.  
  2625.   /* We know our target cannot conflict, since safe_from_p has been called.  */
  2626. #if 0
  2627.   /* Don't try copying piece by piece into a hard register
  2628.      since that is vulnerable to being clobbered by EXP.
  2629.      Instead, construct in a pseudo register and then copy it all.  */
  2630.   if (GET_CODE (target) == REG && REGNO (target) < FIRST_PSEUDO_REGISTER)
  2631.     {
  2632.       rtx temp = gen_reg_rtx (GET_MODE (target));
  2633.       store_constructor (exp, temp);
  2634.       emit_move_insn (target, temp);
  2635.       return;
  2636.     }
  2637. #endif
  2638.  
  2639.   if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE)
  2640.     {
  2641.       register tree elt;
  2642.  
  2643.       /* Inform later passes that the whole union value is dead.  */
  2644.       if (TREE_CODE (type) == UNION_TYPE)
  2645.     emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  2646.  
  2647.       /* If we are building a static constructor into a register,
  2648.      set the initial value as zero so we can fold the value into
  2649.      a constant.  */
  2650.       else if (GET_CODE (target) == REG && TREE_STATIC (exp))
  2651.     emit_move_insn (target, const0_rtx);
  2652.  
  2653.       /* If the constructor has fewer fields than the structure,
  2654.      clear the whole structure first.  */
  2655.       else if (list_length (CONSTRUCTOR_ELTS (exp))
  2656.            != list_length (TYPE_FIELDS (type)))
  2657.     clear_storage (target, int_size_in_bytes (type));
  2658.       else
  2659.     /* Inform later passes that the old value is dead.  */
  2660.     emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  2661.  
  2662.       /* Store each element of the constructor into
  2663.      the corresponding field of TARGET.  */
  2664.  
  2665.       for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
  2666.     {
  2667.       register tree field = TREE_PURPOSE (elt);
  2668.       register enum machine_mode mode;
  2669.       int bitsize;
  2670.       int bitpos;
  2671.       int unsignedp;
  2672.  
  2673.       /* Just ignore missing fields.
  2674.          We cleared the whole structure, above,
  2675.          if any fields are missing.  */
  2676.       if (field == 0)
  2677.         continue;
  2678.  
  2679.       bitsize = TREE_INT_CST_LOW (DECL_SIZE (field));
  2680.       unsignedp = TREE_UNSIGNED (field);
  2681.       mode = DECL_MODE (field);
  2682.       if (DECL_BIT_FIELD (field))
  2683.         mode = VOIDmode;
  2684.  
  2685.       if (TREE_CODE (DECL_FIELD_BITPOS (field)) != INTEGER_CST)
  2686.         /* ??? This case remains to be written.  */
  2687.         abort ();
  2688.  
  2689.       bitpos = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field));
  2690.  
  2691.       store_field (target, bitsize, bitpos, mode, TREE_VALUE (elt),
  2692.                /* The alignment of TARGET is
  2693.               at least what its type requires.  */
  2694.                VOIDmode, 0,
  2695.                TYPE_ALIGN (type) / BITS_PER_UNIT,
  2696.                int_size_in_bytes (type));
  2697.     }
  2698.     }
  2699.   else if (TREE_CODE (type) == ARRAY_TYPE)
  2700.     {
  2701.       register tree elt;
  2702.       register int i;
  2703.       tree domain = TYPE_DOMAIN (type);
  2704.       HOST_WIDE_INT minelt = TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain));
  2705.       HOST_WIDE_INT maxelt = TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain));
  2706.       tree elttype = TREE_TYPE (type);
  2707.  
  2708.       /* If the constructor has fewer fields than the structure,
  2709.      clear the whole structure first.  Similarly if this this is
  2710.      static constructor of a non-BLKmode object.  */
  2711.  
  2712.       if (list_length (CONSTRUCTOR_ELTS (exp)) < maxelt - minelt + 1
  2713.       || (GET_CODE (target) == REG && TREE_STATIC (exp)))
  2714.     clear_storage (target, maxelt - minelt + 1);
  2715.       else
  2716.     /* Inform later passes that the old value is dead.  */
  2717.     emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  2718.  
  2719.       /* Store each element of the constructor into
  2720.      the corresponding element of TARGET, determined
  2721.      by counting the elements.  */
  2722.       for (elt = CONSTRUCTOR_ELTS (exp), i = 0;
  2723.        elt;
  2724.        elt = TREE_CHAIN (elt), i++)
  2725.     {
  2726.       register enum machine_mode mode;
  2727.       int bitsize;
  2728.       int bitpos;
  2729.       int unsignedp;
  2730.  
  2731.       mode = TYPE_MODE (elttype);
  2732.       bitsize = GET_MODE_BITSIZE (mode);
  2733.       unsignedp = TREE_UNSIGNED (elttype);
  2734.  
  2735.       bitpos = (i * TREE_INT_CST_LOW (TYPE_SIZE (elttype)));
  2736.  
  2737.       store_field (target, bitsize, bitpos, mode, TREE_VALUE (elt),
  2738.                /* The alignment of TARGET is
  2739.               at least what its type requires.  */
  2740.                VOIDmode, 0,
  2741.                TYPE_ALIGN (type) / BITS_PER_UNIT,
  2742.                int_size_in_bytes (type));
  2743.     }
  2744.     }
  2745.  
  2746.   else
  2747.     abort ();
  2748. }
  2749.  
  2750. /* Store the value of EXP (an expression tree)
  2751.    into a subfield of TARGET which has mode MODE and occupies
  2752.    BITSIZE bits, starting BITPOS bits from the start of TARGET.
  2753.    If MODE is VOIDmode, it means that we are storing into a bit-field.
  2754.  
  2755.    If VALUE_MODE is VOIDmode, return nothing in particular.
  2756.    UNSIGNEDP is not used in this case.
  2757.  
  2758.    Otherwise, return an rtx for the value stored.  This rtx
  2759.    has mode VALUE_MODE if that is convenient to do.
  2760.    In this case, UNSIGNEDP must be nonzero if the value is an unsigned type.
  2761.  
  2762.    ALIGN is the alignment that TARGET is known to have, measured in bytes.
  2763.    TOTAL_SIZE is the size in bytes of the structure, or -1 if varying.  */
  2764.  
  2765. static rtx
  2766. store_field (target, bitsize, bitpos, mode, exp, value_mode,
  2767.          unsignedp, align, total_size)
  2768.      rtx target;
  2769.      int bitsize, bitpos;
  2770.      enum machine_mode mode;
  2771.      tree exp;
  2772.      enum machine_mode value_mode;
  2773.      int unsignedp;
  2774.      int align;
  2775.      int total_size;
  2776. {
  2777.   HOST_WIDE_INT width_mask = 0;
  2778.  
  2779.   if (bitsize < HOST_BITS_PER_WIDE_INT)
  2780.     width_mask = ((HOST_WIDE_INT) 1 << bitsize) - 1;
  2781.  
  2782.   /* If we are storing into an unaligned field of an aligned union that is
  2783.      in a register, we may have the mode of TARGET being an integer mode but
  2784.      MODE == BLKmode.  In that case, get an aligned object whose size and
  2785.      alignment are the same as TARGET and store TARGET into it (we can avoid
  2786.      the store if the field being stored is the entire width of TARGET).  Then
  2787.      call ourselves recursively to store the field into a BLKmode version of
  2788.      that object.  Finally, load from the object into TARGET.  This is not
  2789.      very efficient in general, but should only be slightly more expensive
  2790.      than the otherwise-required unaligned accesses.  Perhaps this can be
  2791.      cleaned up later.  */
  2792.  
  2793.   if (mode == BLKmode
  2794.       && (GET_CODE (target) == REG || GET_CODE (target) == SUBREG))
  2795.     {
  2796.       rtx object = assign_stack_temp (GET_MODE (target),
  2797.                       GET_MODE_SIZE (GET_MODE (target)), 0);
  2798.       rtx blk_object = copy_rtx (object);
  2799.  
  2800.       PUT_MODE (blk_object, BLKmode);
  2801.  
  2802.       if (bitsize != GET_MODE_BITSIZE (GET_MODE (target)))
  2803.     emit_move_insn (object, target);
  2804.  
  2805.       store_field (blk_object, bitsize, bitpos, mode, exp, VOIDmode, 0,
  2806.            align, total_size);
  2807.  
  2808.       emit_move_insn (target, object);
  2809.  
  2810.       return target;
  2811.     }
  2812.  
  2813.   /* If the structure is in a register or if the component
  2814.      is a bit field, we cannot use addressing to access it.
  2815.      Use bit-field techniques or SUBREG to store in it.  */
  2816.  
  2817.   if (mode == VOIDmode
  2818.       || (mode != BLKmode && ! direct_store[(int) mode])
  2819.       || GET_CODE (target) == REG
  2820.       || GET_CODE (target) == SUBREG)
  2821.     {
  2822.       rtx temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);
  2823.       /* Store the value in the bitfield.  */
  2824.       store_bit_field (target, bitsize, bitpos, mode, temp, align, total_size);
  2825.       if (value_mode != VOIDmode)
  2826.     {
  2827.       /* The caller wants an rtx for the value.  */
  2828.       /* If possible, avoid refetching from the bitfield itself.  */
  2829.       if (width_mask != 0
  2830.           && ! (GET_CODE (target) == MEM && MEM_VOLATILE_P (target)))
  2831.         {
  2832.           tree count;
  2833.           enum machine_mode tmode;
  2834.  
  2835.           if (unsignedp)
  2836.         return expand_and (temp, GEN_INT (width_mask), NULL_RTX);
  2837.           tmode = GET_MODE (temp);
  2838.           if (tmode == VOIDmode)
  2839.         tmode = value_mode;
  2840.           count = build_int_2 (GET_MODE_BITSIZE (tmode) - bitsize, 0);
  2841.           temp = expand_shift (LSHIFT_EXPR, tmode, temp, count, 0, 0);
  2842.           return expand_shift (RSHIFT_EXPR, tmode, temp, count, 0, 0);
  2843.         }
  2844.       return extract_bit_field (target, bitsize, bitpos, unsignedp,
  2845.                     NULL_RTX, value_mode, 0, align,
  2846.                     total_size);
  2847.     }
  2848.       return const0_rtx;
  2849.     }
  2850.   else
  2851.     {
  2852.       rtx addr = XEXP (target, 0);
  2853.       rtx to_rtx;
  2854.  
  2855.       /* If a value is wanted, it must be the lhs;
  2856.      so make the address stable for multiple use.  */
  2857.  
  2858.       if (value_mode != VOIDmode && GET_CODE (addr) != REG
  2859.       && ! CONSTANT_ADDRESS_P (addr)
  2860.       /* A frame-pointer reference is already stable.  */
  2861.       && ! (GET_CODE (addr) == PLUS
  2862.         && GET_CODE (XEXP (addr, 1)) == CONST_INT
  2863.         && (XEXP (addr, 0) == virtual_incoming_args_rtx
  2864.             || XEXP (addr, 0) == virtual_stack_vars_rtx)))
  2865.     addr = copy_to_reg (addr);
  2866.  
  2867.       /* Now build a reference to just the desired component.  */
  2868.  
  2869.       to_rtx = change_address (target, mode,
  2870.                    plus_constant (addr, (bitpos / BITS_PER_UNIT)));
  2871.       MEM_IN_STRUCT_P (to_rtx) = 1;
  2872.  
  2873.       return store_expr (exp, to_rtx, value_mode != VOIDmode);
  2874.     }
  2875. }
  2876.  
  2877. /* Given an expression EXP that may be a COMPONENT_REF, a BIT_FIELD_REF,
  2878.    or an ARRAY_REF, look for nested COMPONENT_REFs, BIT_FIELD_REFs, or
  2879.    ARRAY_REFs at constant positions and find the ultimate containing object,
  2880.    which we return.
  2881.  
  2882.    We set *PBITSIZE to the size in bits that we want, *PBITPOS to the
  2883.    bit position, and *PUNSIGNEDP to the signedness of the field.
  2884.    If the position of the field is variable, we store a tree
  2885.    giving the variable offset (in units) in *POFFSET.
  2886.    This offset is in addition to the bit position.
  2887.    If the position is not variable, we store 0 in *POFFSET.
  2888.  
  2889.    If any of the extraction expressions is volatile,
  2890.    we store 1 in *PVOLATILEP.  Otherwise we don't change that.
  2891.  
  2892.    If the field is a bit-field, *PMODE is set to VOIDmode.  Otherwise, it
  2893.    is a mode that can be used to access the field.  In that case, *PBITSIZE
  2894.    is redundant.
  2895.  
  2896.    If the field describes a variable-sized object, *PMODE is set to
  2897.    VOIDmode and *PBITSIZE is set to -1.  An access cannot be made in
  2898.    this case, but the address of the object can be found.  */
  2899.  
  2900. tree
  2901. get_inner_reference (exp, pbitsize, pbitpos, poffset, pmode, punsignedp, pvolatilep)
  2902.      tree exp;
  2903.      int *pbitsize;
  2904.      int *pbitpos;
  2905.      tree *poffset;
  2906.      enum machine_mode *pmode;
  2907.      int *punsignedp;
  2908.      int *pvolatilep;
  2909. {
  2910.   tree size_tree = 0;
  2911.   enum machine_mode mode = VOIDmode;
  2912.   tree offset = 0;
  2913.  
  2914.   if (TREE_CODE (exp) == COMPONENT_REF)
  2915.     {
  2916.       size_tree = DECL_SIZE (TREE_OPERAND (exp, 1));
  2917.       if (! DECL_BIT_FIELD (TREE_OPERAND (exp, 1)))
  2918.     mode = DECL_MODE (TREE_OPERAND (exp, 1));
  2919.       *punsignedp = TREE_UNSIGNED (TREE_OPERAND (exp, 1));
  2920.     }
  2921.   else if (TREE_CODE (exp) == BIT_FIELD_REF)
  2922.     {
  2923.       size_tree = TREE_OPERAND (exp, 1);
  2924.       *punsignedp = TREE_UNSIGNED (exp);
  2925.     }
  2926.   else
  2927.     {
  2928.       mode = TYPE_MODE (TREE_TYPE (exp));
  2929.       *pbitsize = GET_MODE_BITSIZE (mode);
  2930.       *punsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  2931.     }
  2932.       
  2933.   if (size_tree)
  2934.     {
  2935.       if (TREE_CODE (size_tree) != INTEGER_CST)
  2936.     mode = BLKmode, *pbitsize = -1;
  2937.       else
  2938.     *pbitsize = TREE_INT_CST_LOW (size_tree);
  2939.     }
  2940.  
  2941.   /* Compute cumulative bit-offset for nested component-refs and array-refs,
  2942.      and find the ultimate containing object.  */
  2943.  
  2944.   *pbitpos = 0;
  2945.  
  2946.   while (1)
  2947.     {
  2948.       if (TREE_CODE (exp) == INDIRECT_REF && flag_volatile)
  2949.      *pvolatilep = 1;
  2950.  
  2951.       if (TREE_CODE (exp) == COMPONENT_REF || TREE_CODE (exp) == BIT_FIELD_REF)
  2952.     {
  2953.       tree pos = (TREE_CODE (exp) == COMPONENT_REF
  2954.               ? DECL_FIELD_BITPOS (TREE_OPERAND (exp, 1))
  2955.               : TREE_OPERAND (exp, 2));
  2956.  
  2957.       if (TREE_CODE (pos) == PLUS_EXPR)
  2958.         {
  2959.           tree constant, var;
  2960.           if (TREE_CODE (TREE_OPERAND (pos, 0)) == INTEGER_CST)
  2961.         {
  2962.           constant = TREE_OPERAND (pos, 0);
  2963.           var = TREE_OPERAND (pos, 1);
  2964.         }
  2965.           else if (TREE_CODE (TREE_OPERAND (pos, 1)) == INTEGER_CST)
  2966.         {
  2967.           constant = TREE_OPERAND (pos, 1);
  2968.           var = TREE_OPERAND (pos, 0);
  2969.         }
  2970.           else
  2971.         abort ();
  2972.           *pbitpos += TREE_INT_CST_LOW (constant);
  2973.           if (offset)
  2974.         offset = size_binop (PLUS_EXPR, offset,
  2975.                      size_binop (FLOOR_DIV_EXPR, var,
  2976.                          size_int (BITS_PER_UNIT)));
  2977.           else
  2978.         offset = size_binop (FLOOR_DIV_EXPR, var,
  2979.                      size_int (BITS_PER_UNIT));
  2980.         }
  2981.       else if (TREE_CODE (pos) == INTEGER_CST)
  2982.         *pbitpos += TREE_INT_CST_LOW (pos);
  2983.       else
  2984.         {
  2985.           /* Assume here that the offset is a multiple of a unit.
  2986.          If not, there should be an explicitly added constant.  */
  2987.           if (offset)
  2988.         offset = size_binop (PLUS_EXPR, offset,
  2989.                      size_binop (FLOOR_DIV_EXPR, pos,
  2990.                          size_int (BITS_PER_UNIT)));
  2991.           else
  2992.         offset = size_binop (FLOOR_DIV_EXPR, pos,
  2993.                      size_int (BITS_PER_UNIT));
  2994.         }
  2995.     }
  2996.  
  2997.       else if (TREE_CODE (exp) == ARRAY_REF
  2998.            && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  2999.            && TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) == INTEGER_CST)
  3000.     {
  3001.       *pbitpos += (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))
  3002.                * TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp))));
  3003.     }
  3004.       else if (TREE_CODE (exp) != NON_LVALUE_EXPR
  3005.            && ! ((TREE_CODE (exp) == NOP_EXPR
  3006.               || TREE_CODE (exp) == CONVERT_EXPR)
  3007.              && (TYPE_MODE (TREE_TYPE (exp))
  3008.              == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))))
  3009.     break;
  3010.  
  3011.       /* If any reference in the chain is volatile, the effect is volatile.  */
  3012.       if (TREE_THIS_VOLATILE (exp))
  3013.     *pvolatilep = 1;
  3014.       exp = TREE_OPERAND (exp, 0);
  3015.     }
  3016.  
  3017.   /* If this was a bit-field, see if there is a mode that allows direct
  3018.      access in case EXP is in memory.  */
  3019.   if (mode == VOIDmode && *pbitpos % *pbitsize == 0)
  3020.     {
  3021.       mode = mode_for_size (*pbitsize, MODE_INT, 0);
  3022.       if (mode == BLKmode)
  3023.     mode = VOIDmode;
  3024.     }
  3025.  
  3026.   *pmode = mode;
  3027.   *poffset = offset;
  3028. #if 0
  3029.   /* We aren't finished fixing the callers to really handle nonzero offset.  */
  3030.   if (offset != 0)
  3031.     abort ();
  3032. #endif
  3033.  
  3034.   return exp;
  3035. }
  3036.  
  3037. /* Given an rtx VALUE that may contain additions and multiplications,
  3038.    return an equivalent value that just refers to a register or memory.
  3039.    This is done by generating instructions to perform the arithmetic
  3040.    and returning a pseudo-register containing the value.
  3041.  
  3042.    The returned value may be a REG, SUBREG, MEM or constant.  */
  3043.  
  3044. rtx
  3045. force_operand (value, target)
  3046.      rtx value, target;
  3047. {
  3048.   register optab binoptab = 0;
  3049.   /* Use a temporary to force order of execution of calls to
  3050.      `force_operand'.  */
  3051.   rtx tmp;
  3052.   register rtx op2;
  3053.   /* Use subtarget as the target for operand 0 of a binary operation.  */
  3054.   register rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
  3055.  
  3056.   if (GET_CODE (value) == PLUS)
  3057.     binoptab = add_optab;
  3058.   else if (GET_CODE (value) == MINUS)
  3059.     binoptab = sub_optab;
  3060.   else if (GET_CODE (value) == MULT)
  3061.     {
  3062.       op2 = XEXP (value, 1);
  3063.       if (!CONSTANT_P (op2)
  3064.       && !(GET_CODE (op2) == REG && op2 != subtarget))
  3065.     subtarget = 0;
  3066.       tmp = force_operand (XEXP (value, 0), subtarget);
  3067.       return expand_mult (GET_MODE (value), tmp,
  3068.               force_operand (op2, NULL_RTX),
  3069.               target, 0);
  3070.     }
  3071.  
  3072.   if (binoptab)
  3073.     {
  3074.       op2 = XEXP (value, 1);
  3075.       if (!CONSTANT_P (op2)
  3076.       && !(GET_CODE (op2) == REG && op2 != subtarget))
  3077.     subtarget = 0;
  3078.       if (binoptab == sub_optab && GET_CODE (op2) == CONST_INT)
  3079.     {
  3080.       binoptab = add_optab;
  3081.       op2 = negate_rtx (GET_MODE (value), op2);
  3082.     }
  3083.  
  3084.       /* Check for an addition with OP2 a constant integer and our first
  3085.      operand a PLUS of a virtual register and something else.  In that
  3086.      case, we want to emit the sum of the virtual register and the
  3087.      constant first and then add the other value.  This allows virtual
  3088.      register instantiation to simply modify the constant rather than
  3089.      creating another one around this addition.  */
  3090.       if (binoptab == add_optab && GET_CODE (op2) == CONST_INT
  3091.       && GET_CODE (XEXP (value, 0)) == PLUS
  3092.       && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
  3093.       && REGNO (XEXP (XEXP (value, 0), 0)) >= FIRST_VIRTUAL_REGISTER
  3094.       && REGNO (XEXP (XEXP (value, 0), 0)) <= LAST_VIRTUAL_REGISTER)
  3095.     {
  3096.       rtx temp = expand_binop (GET_MODE (value), binoptab,
  3097.                    XEXP (XEXP (value, 0), 0), op2,
  3098.                    subtarget, 0, OPTAB_LIB_WIDEN);
  3099.       return expand_binop (GET_MODE (value), binoptab, temp,
  3100.                    force_operand (XEXP (XEXP (value, 0), 1), 0),
  3101.                    target, 0, OPTAB_LIB_WIDEN);
  3102.     }
  3103.                    
  3104.       tmp = force_operand (XEXP (value, 0), subtarget);
  3105.       return expand_binop (GET_MODE (value), binoptab, tmp,
  3106.                force_operand (op2, NULL_RTX),
  3107.                target, 0, OPTAB_LIB_WIDEN);
  3108.       /* We give UNSIGNEP = 0 to expand_binop
  3109.      because the only operations we are expanding here are signed ones.  */
  3110.     }
  3111.   return value;
  3112. }
  3113.  
  3114. /* Subroutine of expand_expr:
  3115.    save the non-copied parts (LIST) of an expr (LHS), and return a list
  3116.    which can restore these values to their previous values,
  3117.    should something modify their storage.  */
  3118.  
  3119. static tree
  3120. save_noncopied_parts (lhs, list)
  3121.      tree lhs;
  3122.      tree list;
  3123. {
  3124.   tree tail;
  3125.   tree parts = 0;
  3126.  
  3127.   for (tail = list; tail; tail = TREE_CHAIN (tail))
  3128.     if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
  3129.       parts = chainon (parts, save_noncopied_parts (lhs, TREE_VALUE (tail)));
  3130.     else
  3131.       {
  3132.     tree part = TREE_VALUE (tail);
  3133.     tree part_type = TREE_TYPE (part);
  3134.     tree to_be_saved = build (COMPONENT_REF, part_type, lhs, part);
  3135.     rtx target = assign_stack_temp (TYPE_MODE (part_type),
  3136.                     int_size_in_bytes (part_type), 0);
  3137.     if (! memory_address_p (TYPE_MODE (part_type), XEXP (target, 0)))
  3138.       target = change_address (target, TYPE_MODE (part_type), NULL_RTX);
  3139.     parts = tree_cons (to_be_saved,
  3140.                build (RTL_EXPR, part_type, NULL_TREE,
  3141.                   (tree) target),
  3142.                parts);
  3143.     store_expr (TREE_PURPOSE (parts), RTL_EXPR_RTL (TREE_VALUE (parts)), 0);
  3144.       }
  3145.   return parts;
  3146. }
  3147.  
  3148. /* Subroutine of expand_expr:
  3149.    record the non-copied parts (LIST) of an expr (LHS), and return a list
  3150.    which specifies the initial values of these parts.  */
  3151.  
  3152. static tree
  3153. init_noncopied_parts (lhs, list)
  3154.      tree lhs;
  3155.      tree list;
  3156. {
  3157.   tree tail;
  3158.   tree parts = 0;
  3159.  
  3160.   for (tail = list; tail; tail = TREE_CHAIN (tail))
  3161.     if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
  3162.       parts = chainon (parts, init_noncopied_parts (lhs, TREE_VALUE (tail)));
  3163.     else
  3164.       {
  3165.     tree part = TREE_VALUE (tail);
  3166.     tree part_type = TREE_TYPE (part);
  3167.     tree to_be_initialized = build (COMPONENT_REF, part_type, lhs, part);
  3168.     parts = tree_cons (TREE_PURPOSE (tail), to_be_initialized, parts);
  3169.       }
  3170.   return parts;
  3171. }
  3172.  
  3173. /* Subroutine of expand_expr: return nonzero iff there is no way that
  3174.    EXP can reference X, which is being modified.  */
  3175.  
  3176. static int
  3177. safe_from_p (x, exp)
  3178.      rtx x;
  3179.      tree exp;
  3180. {
  3181.   rtx exp_rtl = 0;
  3182.   int i, nops;
  3183.  
  3184.   if (x == 0)
  3185.     return 1;
  3186.  
  3187.   /* If this is a subreg of a hard register, declare it unsafe, otherwise,
  3188.      find the underlying pseudo.  */
  3189.   if (GET_CODE (x) == SUBREG)
  3190.     {
  3191.       x = SUBREG_REG (x);
  3192.       if (GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
  3193.     return 0;
  3194.     }
  3195.  
  3196.   /* If X is a location in the outgoing argument area, it is always safe.  */
  3197.   if (GET_CODE (x) == MEM
  3198.       && (XEXP (x, 0) == virtual_outgoing_args_rtx
  3199.       || (GET_CODE (XEXP (x, 0)) == PLUS
  3200.           && XEXP (XEXP (x, 0), 0) == virtual_outgoing_args_rtx)))
  3201.     return 1;
  3202.  
  3203.   switch (TREE_CODE_CLASS (TREE_CODE (exp)))
  3204.     {
  3205.     case 'd':
  3206.       exp_rtl = DECL_RTL (exp);
  3207.       break;
  3208.  
  3209.     case 'c':
  3210.       return 1;
  3211.  
  3212.     case 'x':
  3213.       if (TREE_CODE (exp) == TREE_LIST)
  3214.     return ((TREE_VALUE (exp) == 0
  3215.          || safe_from_p (x, TREE_VALUE (exp)))
  3216.         && (TREE_CHAIN (exp) == 0
  3217.             || safe_from_p (x, TREE_CHAIN (exp))));
  3218.       else
  3219.     return 0;
  3220.  
  3221.     case '1':
  3222.       return safe_from_p (x, TREE_OPERAND (exp, 0));
  3223.  
  3224.     case '2':
  3225.     case '<':
  3226.       return (safe_from_p (x, TREE_OPERAND (exp, 0))
  3227.           && safe_from_p (x, TREE_OPERAND (exp, 1)));
  3228.  
  3229.     case 'e':
  3230.     case 'r':
  3231.       /* Now do code-specific tests.  EXP_RTL is set to any rtx we find in
  3232.      the expression.  If it is set, we conflict iff we are that rtx or
  3233.      both are in memory.  Otherwise, we check all operands of the
  3234.      expression recursively.  */
  3235.  
  3236.       switch (TREE_CODE (exp))
  3237.     {
  3238.     case ADDR_EXPR:
  3239.       return staticp (TREE_OPERAND (exp, 0));
  3240.  
  3241.     case INDIRECT_REF:
  3242.       if (GET_CODE (x) == MEM)
  3243.         return 0;
  3244.       break;
  3245.  
  3246.     case CALL_EXPR:
  3247.       exp_rtl = CALL_EXPR_RTL (exp);
  3248.       if (exp_rtl == 0)
  3249.         {
  3250.           /* Assume that the call will clobber all hard registers and
  3251.          all of memory.  */
  3252.           if ((GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
  3253.           || GET_CODE (x) == MEM)
  3254.         return 0;
  3255.         }
  3256.  
  3257.       break;
  3258.  
  3259.     case RTL_EXPR:
  3260.       exp_rtl = RTL_EXPR_RTL (exp);
  3261.       if (exp_rtl == 0)
  3262.         /* We don't know what this can modify.  */
  3263.         return 0;
  3264.  
  3265.       break;
  3266.  
  3267.     case WITH_CLEANUP_EXPR:
  3268.       exp_rtl = RTL_EXPR_RTL (exp);
  3269.       break;
  3270.  
  3271.     case SAVE_EXPR:
  3272.       exp_rtl = SAVE_EXPR_RTL (exp);
  3273.       break;
  3274.  
  3275.     case BIND_EXPR:
  3276.       /* The only operand we look at is operand 1.  The rest aren't
  3277.          part of the expression.  */
  3278.       return safe_from_p (x, TREE_OPERAND (exp, 1));
  3279.  
  3280.     case METHOD_CALL_EXPR:
  3281.       /* This takes a rtx argument, but shouldn't appear here. */
  3282.       abort ();
  3283.     }
  3284.  
  3285.       /* If we have an rtx, we do not need to scan our operands.  */
  3286.       if (exp_rtl)
  3287.     break;
  3288.  
  3289.       nops = tree_code_length[(int) TREE_CODE (exp)];
  3290.       for (i = 0; i < nops; i++)
  3291.     if (TREE_OPERAND (exp, i) != 0
  3292.         && ! safe_from_p (x, TREE_OPERAND (exp, i)))
  3293.       return 0;
  3294.     }
  3295.  
  3296.   /* If we have an rtl, find any enclosed object.  Then see if we conflict
  3297.      with it.  */
  3298.   if (exp_rtl)
  3299.     {
  3300.       if (GET_CODE (exp_rtl) == SUBREG)
  3301.     {
  3302.       exp_rtl = SUBREG_REG (exp_rtl);
  3303.       if (GET_CODE (exp_rtl) == REG
  3304.           && REGNO (exp_rtl) < FIRST_PSEUDO_REGISTER)
  3305.         return 0;
  3306.     }
  3307.  
  3308.       /* If the rtl is X, then it is not safe.  Otherwise, it is unless both
  3309.      are memory and EXP is not readonly.  */
  3310.       return ! (rtx_equal_p (x, exp_rtl)
  3311.         || (GET_CODE (x) == MEM && GET_CODE (exp_rtl) == MEM
  3312.             && ! TREE_READONLY (exp)));
  3313.     }
  3314.  
  3315.   /* If we reach here, it is safe.  */
  3316.   return 1;
  3317. }
  3318.  
  3319. /* Subroutine of expand_expr: return nonzero iff EXP is an
  3320.    expression whose type is statically determinable.  */
  3321.  
  3322. static int
  3323. fixed_type_p (exp)
  3324.      tree exp;
  3325. {
  3326.   if (TREE_CODE (exp) == PARM_DECL
  3327.       || TREE_CODE (exp) == VAR_DECL
  3328.       || TREE_CODE (exp) == CALL_EXPR || TREE_CODE (exp) == TARGET_EXPR
  3329.       || TREE_CODE (exp) == COMPONENT_REF
  3330.       || TREE_CODE (exp) == ARRAY_REF)
  3331.     return 1;
  3332.   return 0;
  3333. }
  3334.  
  3335. #ifdef MPW
  3336. #pragma segment EXPR01
  3337. #endif
  3338.  
  3339. /* expand_expr: generate code for computing expression EXP.
  3340.    An rtx for the computed value is returned.  The value is never null.
  3341.    In the case of a void EXP, const0_rtx is returned.
  3342.  
  3343.    The value may be stored in TARGET if TARGET is nonzero.
  3344.    TARGET is just a suggestion; callers must assume that
  3345.    the rtx returned may not be the same as TARGET.
  3346.  
  3347.    If TARGET is CONST0_RTX, it means that the value will be ignored.
  3348.  
  3349.    If TMODE is not VOIDmode, it suggests generating the
  3350.    result in mode TMODE.  But this is done only when convenient.
  3351.    Otherwise, TMODE is ignored and the value generated in its natural mode.
  3352.    TMODE is just a suggestion; callers must assume that
  3353.    the rtx returned may not have mode TMODE.
  3354.  
  3355.    EXPAND_CONST_ADDRESS says that it is okay to return a MEM
  3356.    with a constant address even if that address is not normally legitimate.
  3357.    EXPAND_INITIALIZER and EXPAND_SUM also have this effect.
  3358.  
  3359.    If MODIFIER is EXPAND_SUM then when EXP is an addition
  3360.    we can return an rtx of the form (MULT (REG ...) (CONST_INT ...))
  3361.    or a nest of (PLUS ...) and (MINUS ...) where the terms are
  3362.    products as above, or REG or MEM, or constant.
  3363.    Ordinarily in such cases we would output mul or add instructions
  3364.    and then return a pseudo reg containing the sum.
  3365.  
  3366.    EXPAND_INITIALIZER is much like EXPAND_SUM except that
  3367.    it also marks a label as absolutely required (it can't be dead).
  3368.    It also makes a ZERO_EXTEND or SIGN_EXTEND instead of emitting extend insns.
  3369.    This is used for outputting expressions used in initializers.  */
  3370.  
  3371. rtx
  3372. expand_expr (exp, target, tmode, modifier)
  3373.      register tree exp;
  3374.      rtx target;
  3375.      enum machine_mode tmode;
  3376.      enum expand_modifier modifier;
  3377. {
  3378.   register rtx op0, op1, temp;
  3379.   tree type = TREE_TYPE (exp);
  3380.   int unsignedp = TREE_UNSIGNED (type);
  3381.   register enum machine_mode mode = TYPE_MODE (type);
  3382.   register enum tree_code code = TREE_CODE (exp);
  3383.   optab this_optab;
  3384.   /* Use subtarget as the target for operand 0 of a binary operation.  */
  3385.   rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
  3386.   rtx original_target = target;
  3387.   int ignore = target == const0_rtx;
  3388.   tree context;
  3389.  
  3390.   /* Don't use hard regs as subtargets, because the combiner
  3391.      can only handle pseudo regs.  */
  3392.   if (subtarget && REGNO (subtarget) < FIRST_PSEUDO_REGISTER)
  3393.     subtarget = 0;
  3394.   /* Avoid subtargets inside loops,
  3395.      since they hide some invariant expressions.  */
  3396.   if (preserve_subexpressions_p ())
  3397.     subtarget = 0;
  3398.  
  3399.   if (ignore) target = 0, original_target = 0;
  3400.  
  3401.   /* If will do cse, generate all results into pseudo registers
  3402.      since 1) that allows cse to find more things
  3403.      and 2) otherwise cse could produce an insn the machine
  3404.      cannot support.  */
  3405.  
  3406.   if (! cse_not_expected && mode != BLKmode && target
  3407.       && (GET_CODE (target) != REG || REGNO (target) < FIRST_PSEUDO_REGISTER))
  3408.     target = subtarget;
  3409.  
  3410.   /* Ensure we reference a volatile object even if value is ignored.  */
  3411.   if (ignore && TREE_THIS_VOLATILE (exp)
  3412.       && mode != VOIDmode && mode != BLKmode)
  3413.     {
  3414.       target = gen_reg_rtx (mode);
  3415.       temp = expand_expr (exp, target, VOIDmode, modifier);
  3416.       if (temp != target)
  3417.     emit_move_insn (target, temp);
  3418.       return target;
  3419.     }
  3420.  
  3421.   switch (code)
  3422.     {
  3423.     case LABEL_DECL:
  3424.       {
  3425.     tree function = decl_function_context (exp);
  3426.     /* Handle using a label in a containing function.  */
  3427.     if (function != current_function_decl && function != 0)
  3428.       {
  3429.         struct function *p = find_function_data (function);
  3430.         /* Allocate in the memory associated with the function
  3431.            that the label is in.  */
  3432.         push_obstacks (p->function_obstack,
  3433.                p->function_maybepermanent_obstack);
  3434.  
  3435.         p->forced_labels = gen_rtx (EXPR_LIST, VOIDmode,
  3436.                     label_rtx (exp), p->forced_labels);
  3437.         pop_obstacks ();
  3438.       }
  3439.     else if (modifier == EXPAND_INITIALIZER)
  3440.       forced_labels = gen_rtx (EXPR_LIST, VOIDmode,
  3441.                    label_rtx (exp), forced_labels);
  3442.     temp = gen_rtx (MEM, FUNCTION_MODE,
  3443.             gen_rtx (LABEL_REF, DPmode, label_rtx (exp)));
  3444.     if (function != current_function_decl && function != 0)
  3445.       LABEL_REF_NONLOCAL_P (XEXP (temp, 0)) = 1;
  3446.     return temp;
  3447.       }
  3448.  
  3449.     case PARM_DECL:
  3450.       if (DECL_RTL (exp) == 0)
  3451.     {
  3452.       error_with_decl (exp, "prior parameter's size depends on `%s'");
  3453.       return CONST0_RTX (mode);
  3454.     }
  3455.  
  3456.     case FUNCTION_DECL:
  3457.     case VAR_DECL:
  3458.     case RESULT_DECL:
  3459.       if (DECL_RTL (exp) == 0)
  3460.     abort ();
  3461.       /* Ensure variable marked as used
  3462.      even if it doesn't go through a parser.  */
  3463.       TREE_USED (exp) = 1;
  3464.       /* Handle variables inherited from containing functions.  */
  3465.       context = decl_function_context (exp);
  3466.  
  3467.       /* We treat inline_function_decl as an alias for the current function
  3468.      because that is the inline function whose vars, types, etc.
  3469.      are being merged into the current function.
  3470.      See expand_inline_function.  */
  3471.       if (context != 0 && context != current_function_decl
  3472.       && context != inline_function_decl
  3473.       /* If var is static, we don't need a static chain to access it.  */
  3474.       && ! (GET_CODE (DECL_RTL (exp)) == MEM
  3475.         && CONSTANT_P (XEXP (DECL_RTL (exp), 0))))
  3476.     {
  3477.       rtx addr;
  3478.  
  3479.       /* Mark as non-local and addressable.  */
  3480.       DECL_NONLOCAL (exp) = 1;
  3481.       mark_addressable (exp);
  3482.       if (GET_CODE (DECL_RTL (exp)) != MEM)
  3483.         abort ();
  3484.       addr = XEXP (DECL_RTL (exp), 0);
  3485.       if (GET_CODE (addr) == MEM)
  3486.         addr = gen_rtx (MEM, DPmode, fix_lexical_addr (XEXP (addr, 0), exp));
  3487.       else
  3488.         addr = fix_lexical_addr (addr, exp);
  3489.       return change_address (DECL_RTL (exp), mode, addr);
  3490.     }
  3491.  
  3492.       /* This is the case of an array whose size is to be determined
  3493.      from its initializer, while the initializer is still being parsed.
  3494.      See expand_decl.  */
  3495.       if (GET_CODE (DECL_RTL (exp)) == MEM
  3496.       && GET_CODE (XEXP (DECL_RTL (exp), 0)) == REG)
  3497.     return change_address (DECL_RTL (exp), GET_MODE (DECL_RTL (exp)),
  3498.                    XEXP (DECL_RTL (exp), 0));
  3499.       if (GET_CODE (DECL_RTL (exp)) == MEM
  3500.       && modifier != EXPAND_CONST_ADDRESS
  3501.       && modifier != EXPAND_SUM
  3502.       && modifier != EXPAND_INITIALIZER)
  3503.     {
  3504.       /* DECL_RTL probably contains a constant address.
  3505.          On RISC machines where a constant address isn't valid,
  3506.          make some insns to get that address into a register.  */
  3507.       if (!memory_address_p (DECL_MODE (exp), XEXP (DECL_RTL (exp), 0))
  3508.           || (flag_force_addr
  3509.           && CONSTANT_ADDRESS_P (XEXP (DECL_RTL (exp), 0))))
  3510.         return change_address (DECL_RTL (exp), VOIDmode,
  3511.                    copy_rtx (XEXP (DECL_RTL (exp), 0)));
  3512.     }
  3513.  
  3514.       /* If the mode of DECL_RTL does not match that of the decl, it
  3515.      must be a promoted value.  We return a SUBREG of the wanted mode,
  3516.      but mark it so that we know that it was already extended.  */
  3517.  
  3518.       if (GET_CODE (DECL_RTL (exp)) == REG
  3519.       && GET_MODE (DECL_RTL (exp)) != mode)
  3520.     {
  3521.       enum machine_mode decl_mode = DECL_MODE (exp);
  3522.  
  3523.       /* Get the signedness used for this variable.  Ensure we get the
  3524.          same mode we got when the variable was declared.  */
  3525.  
  3526.       PROMOTE_MODE (decl_mode, unsignedp, type);
  3527.  
  3528.       if (decl_mode != GET_MODE (DECL_RTL (exp)))
  3529.         abort ();
  3530.  
  3531.       temp = gen_rtx (SUBREG, mode, DECL_RTL (exp), 0);
  3532.       SUBREG_PROMOTED_VAR_P (temp) = 1;
  3533.       SUBREG_PROMOTED_UNSIGNED_P (temp) = unsignedp;
  3534.       return temp;
  3535.     }
  3536.  
  3537.       return DECL_RTL (exp);
  3538.  
  3539.     case INTEGER_CST:
  3540.       return immed_double_const (TREE_INT_CST_LOW (exp),
  3541.                  TREE_INT_CST_HIGH (exp),
  3542.                  mode);
  3543.  
  3544.     case CONST_DECL:
  3545.       return expand_expr (DECL_INITIAL (exp), target, VOIDmode, 0);
  3546.  
  3547.     case REAL_CST:
  3548.       /* If optimized, generate immediate CONST_DOUBLE
  3549.      which will be turned into memory by reload if necessary. 
  3550.      
  3551.      We used to force a register so that loop.c could see it.  But
  3552.      this does not allow gen_* patterns to perform optimizations with
  3553.      the constants.  It also produces two insns in cases like "x = 1.0;".
  3554.      On most machines, floating-point constants are not permitted in
  3555.      many insns, so we'd end up copying it to a register in any case.
  3556.  
  3557.      Now, we do the copying in expand_binop, if appropriate.  */
  3558.       return immed_real_const (exp);
  3559.  
  3560.     case COMPLEX_CST:
  3561.     case STRING_CST:
  3562.       if (! TREE_CST_RTL (exp))
  3563.     output_constant_def (exp);
  3564.  
  3565.       /* TREE_CST_RTL probably contains a constant address.
  3566.      On RISC machines where a constant address isn't valid,
  3567.      make some insns to get that address into a register.  */
  3568.       if (GET_CODE (TREE_CST_RTL (exp)) == MEM
  3569.       && modifier != EXPAND_CONST_ADDRESS
  3570.       && modifier != EXPAND_INITIALIZER
  3571.       && modifier != EXPAND_SUM
  3572.       && !memory_address_p (mode, XEXP (TREE_CST_RTL (exp), 0)))
  3573.     return change_address (TREE_CST_RTL (exp), VOIDmode,
  3574.                    copy_rtx (XEXP (TREE_CST_RTL (exp), 0)));
  3575.       return TREE_CST_RTL (exp);
  3576.  
  3577.     case SAVE_EXPR:
  3578.       context = decl_function_context (exp);
  3579.       /* We treat inline_function_decl as an alias for the current function
  3580.      because that is the inline function whose vars, types, etc.
  3581.      are being merged into the current function.
  3582.      See expand_inline_function.  */
  3583.       if (context == current_function_decl || context == inline_function_decl)
  3584.     context = 0;
  3585.  
  3586.       /* If this is non-local, handle it.  */
  3587.       if (context)
  3588.     {
  3589.       temp = SAVE_EXPR_RTL (exp);
  3590.       if (temp && GET_CODE (temp) == REG)
  3591.         {
  3592.           put_var_into_stack (exp);
  3593.           temp = SAVE_EXPR_RTL (exp);
  3594.         }
  3595.       if (temp == 0 || GET_CODE (temp) != MEM)
  3596.         abort ();
  3597.       return change_address (temp, mode,
  3598.                  fix_lexical_addr (XEXP (temp, 0), exp));
  3599.     }
  3600.       if (SAVE_EXPR_RTL (exp) == 0)
  3601.     {
  3602.       if (mode == BLKmode)
  3603.         temp
  3604.           = assign_stack_temp (mode,
  3605.                    int_size_in_bytes (TREE_TYPE (exp)), 0);
  3606.       else
  3607.         {
  3608.           enum machine_mode var_mode = mode;
  3609.  
  3610.           if (TREE_CODE (type) == INTEGER_TYPE
  3611.           || TREE_CODE (type) == ENUMERAL_TYPE
  3612.           || TREE_CODE (type) == BOOLEAN_TYPE
  3613.           || TREE_CODE (type) == CHAR_TYPE
  3614.           || TREE_CODE (type) == REAL_TYPE
  3615.           || TREE_CODE (type) == POINTER_TYPE
  3616.           || TREE_CODE (type) == OFFSET_TYPE)
  3617.         {
  3618.           PROMOTE_MODE (var_mode, unsignedp, type);
  3619.         }
  3620.  
  3621.           temp = gen_reg_rtx (var_mode);
  3622.         }
  3623.  
  3624.       SAVE_EXPR_RTL (exp) = temp;
  3625.       store_expr (TREE_OPERAND (exp, 0), temp, 0);
  3626.       if (!optimize && GET_CODE (temp) == REG)
  3627.         save_expr_regs = gen_rtx (EXPR_LIST, VOIDmode, temp,
  3628.                       save_expr_regs);
  3629.     }
  3630.  
  3631.       /* If the mode of SAVE_EXPR_RTL does not match that of the expression, it
  3632.      must be a promoted value.  We return a SUBREG of the wanted mode,
  3633.      but mark it so that we know that it was already extended.  Note
  3634.      that `unsignedp' was modified above in this case.  */
  3635.  
  3636.       if (GET_CODE (SAVE_EXPR_RTL (exp)) == REG
  3637.       && GET_MODE (SAVE_EXPR_RTL (exp)) != mode)
  3638.     {
  3639.       temp = gen_rtx (SUBREG, mode, SAVE_EXPR_RTL (exp), 0);
  3640.       SUBREG_PROMOTED_VAR_P (temp) = 1;
  3641.       SUBREG_PROMOTED_UNSIGNED_P (temp) = unsignedp;
  3642.       return temp;
  3643.     }
  3644.  
  3645.       return SAVE_EXPR_RTL (exp);
  3646.  
  3647.     case EXIT_EXPR:
  3648.       /* Exit the current loop if the body-expression is true.  */
  3649.       {
  3650.     rtx label = gen_label_rtx ();
  3651.     do_jump (TREE_OPERAND (exp, 0), label, NULL_RTX);
  3652.     expand_exit_loop (NULL_PTR);
  3653.     emit_label (label);
  3654.       }
  3655.       return const0_rtx;
  3656.  
  3657.     case LOOP_EXPR:
  3658.       expand_start_loop (1);
  3659.       expand_expr_stmt (TREE_OPERAND (exp, 0));
  3660.       expand_end_loop ();
  3661.  
  3662.       return const0_rtx;
  3663.  
  3664.     case BIND_EXPR:
  3665.       {
  3666.     tree vars = TREE_OPERAND (exp, 0);
  3667.     int vars_need_expansion = 0;
  3668.  
  3669.     /* Need to open a binding contour here because
  3670.        if there are any cleanups they most be contained here.  */
  3671.     expand_start_bindings (0);
  3672.  
  3673.     /* Mark the corresponding BLOCK for output in its proper place.  */
  3674.     if (TREE_OPERAND (exp, 2) != 0
  3675.         && ! TREE_USED (TREE_OPERAND (exp, 2)))
  3676.       insert_block (TREE_OPERAND (exp, 2));
  3677.  
  3678.     /* If VARS have not yet been expanded, expand them now.  */
  3679.     while (vars)
  3680.       {
  3681.         if (DECL_RTL (vars) == 0)
  3682.           {
  3683.         vars_need_expansion = 1;
  3684.         expand_decl (vars);
  3685.           }
  3686.         expand_decl_init (vars);
  3687.         vars = TREE_CHAIN (vars);
  3688.       }
  3689.  
  3690.     temp = expand_expr (TREE_OPERAND (exp, 1), target, tmode, modifier);
  3691.  
  3692.     expand_end_bindings (TREE_OPERAND (exp, 0), 0, 0);
  3693.  
  3694.     return temp;
  3695.       }
  3696.  
  3697.     case RTL_EXPR:
  3698.       if (RTL_EXPR_SEQUENCE (exp) == const0_rtx)
  3699.     abort ();
  3700.       emit_insns (RTL_EXPR_SEQUENCE (exp));
  3701.       RTL_EXPR_SEQUENCE (exp) = const0_rtx;
  3702.       return RTL_EXPR_RTL (exp);
  3703.  
  3704.     case CONSTRUCTOR:
  3705.       /* All elts simple constants => refer to a constant in memory.  But
  3706.      if this is a non-BLKmode mode, let it store a field at a time
  3707.      since that should make a CONST_INT or CONST_DOUBLE when we
  3708.      fold.  */
  3709.       if (TREE_STATIC (exp) && (mode == BLKmode || TREE_ADDRESSABLE (exp)))
  3710.     {
  3711.       rtx constructor = output_constant_def (exp);
  3712.       if (modifier != EXPAND_CONST_ADDRESS
  3713.           && modifier != EXPAND_INITIALIZER
  3714.           && modifier != EXPAND_SUM
  3715.           && !memory_address_p (GET_MODE (constructor),
  3716.                     XEXP (constructor, 0)))
  3717.         constructor = change_address (constructor, VOIDmode,
  3718.                       XEXP (constructor, 0));
  3719.       return constructor;
  3720.     }
  3721.  
  3722.       if (ignore)
  3723.     {
  3724.       tree elt;
  3725.       for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
  3726.         expand_expr (TREE_VALUE (elt), const0_rtx, VOIDmode, 0);
  3727.       return const0_rtx;
  3728.     }
  3729.       else
  3730.     {
  3731.       if (target == 0 || ! safe_from_p (target, exp))
  3732.         {
  3733.           if (mode != BLKmode && ! TREE_ADDRESSABLE (exp))
  3734.         target = gen_reg_rtx (mode);
  3735.           else
  3736.         {
  3737.           rtx safe_target = assign_stack_temp (mode, int_size_in_bytes (type), 0);
  3738.           if (target)
  3739.             MEM_IN_STRUCT_P (safe_target) = MEM_IN_STRUCT_P (target);
  3740.           target = safe_target;
  3741.         }
  3742.         }
  3743.       store_constructor (exp, target);
  3744.       return target;
  3745.     }
  3746.  
  3747.     case INDIRECT_REF:
  3748.       {
  3749.     tree exp1 = TREE_OPERAND (exp, 0);
  3750.     tree exp2;
  3751.  
  3752.     /* A SAVE_EXPR as the address in an INDIRECT_EXPR is generated
  3753.        for  *PTR += ANYTHING  where PTR is put inside the SAVE_EXPR.
  3754.        This code has the same general effect as simply doing
  3755.        expand_expr on the save expr, except that the expression PTR
  3756.        is computed for use as a memory address.  This means different
  3757.        code, suitable for indexing, may be generated.  */
  3758.     if (TREE_CODE (exp1) == SAVE_EXPR
  3759.         && SAVE_EXPR_RTL (exp1) == 0
  3760.         && TREE_CODE (exp2 = TREE_OPERAND (exp1, 0)) != ERROR_MARK
  3761.         && ((TYPE_MODE (TREE_TYPE (exp1)) == DPmode) ||
  3762.             TYPE_MODE (TREE_TYPE (exp1)) == TPmode)
  3763.         && ((TYPE_MODE (TREE_TYPE (exp2)) == DPmode) ||
  3764.             (TYPE_MODE (TREE_TYPE (exp2)) == TPmode)))
  3765.       {
  3766.         temp = expand_expr (TREE_OPERAND (exp1, 0), NULL_RTX,
  3767.                 VOIDmode, EXPAND_SUM);
  3768.         op0 = memory_address (mode, temp);
  3769.         op0 = copy_all_regs (op0);
  3770.         SAVE_EXPR_RTL (exp1) = op0;
  3771.       }
  3772.     else
  3773.       {
  3774.         op0 = expand_expr (exp1, NULL_RTX, VOIDmode, EXPAND_SUM);
  3775.         op0 = memory_address (mode, op0);
  3776.       }
  3777.  
  3778.     temp = gen_rtx (MEM, mode, op0);
  3779.     /* If address was computed by addition,
  3780.        mark this as an element of an aggregate.  */
  3781.     if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
  3782.         || (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR
  3783.         && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR)
  3784.         || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
  3785.         || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
  3786.         || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
  3787.         || (TREE_CODE (exp1) == ADDR_EXPR
  3788.         && (exp2 = TREE_OPERAND (exp1, 0))
  3789.         && (TREE_CODE (TREE_TYPE (exp2)) == ARRAY_TYPE
  3790.             || TREE_CODE (TREE_TYPE (exp2)) == RECORD_TYPE
  3791.             || TREE_CODE (TREE_TYPE (exp2)) == UNION_TYPE)))
  3792.       MEM_IN_STRUCT_P (temp) = 1;
  3793.     MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) || flag_volatile;
  3794. #if 0 /* It is incorrectto set RTX_UNCHANGING_P here, because the fact that
  3795.      a location is accessed through a pointer to const does not mean
  3796.      that the value there can never change.  */
  3797.     RTX_UNCHANGING_P (temp) = TREE_READONLY (exp);
  3798. #endif
  3799.     return temp;
  3800.       }
  3801.  
  3802.     case ARRAY_REF:
  3803.       if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST
  3804.       || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
  3805.     {
  3806.       /* Nonconstant array index or nonconstant element size.
  3807.          Generate the tree for *(&array+index) and expand that,
  3808.          except do it in a language-independent way
  3809.          and don't complain about non-lvalue arrays.
  3810.          `mark_addressable' should already have been called
  3811.          for any array for which this case will be reached.  */
  3812.  
  3813.       /* Don't forget the const or volatile flag from the array element. */
  3814.       tree variant_type = build_type_variant (type,
  3815.                           TREE_READONLY (exp),
  3816.                           TREE_THIS_VOLATILE (exp));
  3817.       tree array_adr = build1 (ADDR_EXPR, build_pointer_type (variant_type),
  3818.                    TREE_OPERAND (exp, 0));
  3819.       tree index = TREE_OPERAND (exp, 1);
  3820.       tree elt;
  3821.  
  3822.       /* Convert the integer argument to a type the same size as a pointer
  3823.          so the multiply won't overflow spuriously.  */
  3824.       if (TYPE_PRECISION (TREE_TYPE (index)) != POINTER_SIZE)
  3825.         index = convert (type_for_size (POINTER_SIZE, 0), index);
  3826.  
  3827.       /* Don't think the address has side effects
  3828.          just because the array does.
  3829.          (In some cases the address might have side effects,
  3830.          and we fail to record that fact here.  However, it should not
  3831.          matter, since expand_expr should not care.)  */
  3832.       TREE_SIDE_EFFECTS (array_adr) = 0;
  3833.  
  3834. #ifdef APPLE_HAX
  3835.       elt = build1 (INDIRECT_REF, type,
  3836.             fold (build (PLUS_EXPR, TYPE_POINTER_TO (variant_type),
  3837.                      array_adr,
  3838.                      convert(TYPE_POINTER_TO (variant_type),fold (build (MULT_EXPR,
  3839.                           integer_type_node,
  3840.                           index, size_in_bytes (type)))))));
  3841. #else
  3842.       elt = build1 (INDIRECT_REF, type,
  3843.             fold (build (PLUS_EXPR, TYPE_POINTER_TO (variant_type),
  3844.                      array_adr,
  3845.                      fold (build (MULT_EXPR,
  3846.                           TYPE_POINTER_TO (variant_type),
  3847.                           index, size_in_bytes (type))))));
  3848. #endif
  3849.  
  3850.       /* Volatility, etc., of new expression is same as old expression.  */
  3851.       TREE_SIDE_EFFECTS (elt) = TREE_SIDE_EFFECTS (exp);
  3852.       TREE_THIS_VOLATILE (elt) = TREE_THIS_VOLATILE (exp);
  3853.       TREE_READONLY (elt) = TREE_READONLY (exp);
  3854.  
  3855.       return expand_expr (elt, target, tmode, modifier);
  3856.     }
  3857.  
  3858.       /* Fold an expression like: "foo"[2].
  3859.      This is not done in fold so it won't happen inside &.  */
  3860.       {
  3861.     int i;
  3862.     tree arg0 = TREE_OPERAND (exp, 0);
  3863.     tree arg1 = TREE_OPERAND (exp, 1);
  3864.  
  3865.     if (TREE_CODE (arg0) == STRING_CST
  3866.         && TREE_CODE (arg1) == INTEGER_CST
  3867.         && !TREE_INT_CST_HIGH (arg1)
  3868.         && (i = TREE_INT_CST_LOW (arg1)) < TREE_STRING_LENGTH (arg0))
  3869.       {
  3870.         if (TREE_TYPE (TREE_TYPE (arg0)) == integer_type_node)
  3871.           {
  3872.         exp = build_int_2 (((int *)TREE_STRING_POINTER (arg0))[i], 0);
  3873.         TREE_TYPE (exp) = integer_type_node;
  3874.         return expand_expr (exp, target, tmode, modifier);
  3875.           }
  3876.         if (TREE_TYPE (TREE_TYPE (arg0)) == char_type_node)
  3877.           {
  3878.         exp = build_int_2 (TREE_STRING_POINTER (arg0)[i], 0);
  3879.         TREE_TYPE (exp) = integer_type_node;
  3880.         return expand_expr (convert (TREE_TYPE (TREE_TYPE (arg0)), exp), target, tmode, modifier);
  3881.           }
  3882.       }
  3883.       }
  3884.  
  3885.       /* If this is a constant index into a constant array,
  3886.      just get the value from the array.  Handle both the cases when
  3887.      we have an explicit constructor and when our operand is a variable
  3888.      that was declared const.  */
  3889.  
  3890.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == CONSTRUCTOR
  3891.       && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0)))
  3892.     {
  3893.       tree index = fold (TREE_OPERAND (exp, 1));
  3894.       if (TREE_CODE (index) == INTEGER_CST
  3895.           && TREE_INT_CST_HIGH (index) == 0)
  3896.         {
  3897.           int i = TREE_INT_CST_LOW (index);
  3898.           tree elem = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0));
  3899.  
  3900.           while (elem && i--)
  3901.         elem = TREE_CHAIN (elem);
  3902.           if (elem)
  3903.         return expand_expr (fold (TREE_VALUE (elem)), target,
  3904.                     tmode, modifier);
  3905.         }
  3906.     }
  3907.       
  3908.       else if (TREE_READONLY (TREE_OPERAND (exp, 0))
  3909.            && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0))
  3910.            && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == ARRAY_TYPE
  3911.            && TREE_CODE (TREE_OPERAND (exp, 0)) == VAR_DECL
  3912.            && DECL_INITIAL (TREE_OPERAND (exp, 0))
  3913.            && optimize >= 1
  3914.            && (TREE_CODE (DECL_INITIAL (TREE_OPERAND (exp, 0)))
  3915.            != ERROR_MARK))
  3916.     {
  3917.       tree index = fold (TREE_OPERAND (exp, 1));
  3918.       if (TREE_CODE (index) == INTEGER_CST
  3919.           && TREE_INT_CST_HIGH (index) == 0)
  3920.         {
  3921.           int i = TREE_INT_CST_LOW (index);
  3922.           tree init = DECL_INITIAL (TREE_OPERAND (exp, 0));
  3923.  
  3924.           if (TREE_CODE (init) == CONSTRUCTOR)
  3925.         {
  3926.           tree elem = CONSTRUCTOR_ELTS (init);
  3927.  
  3928.           while (elem && i--)
  3929.             elem = TREE_CHAIN (elem);
  3930.           if (elem)
  3931.             return expand_expr (fold (TREE_VALUE (elem)), target,
  3932.                     tmode, modifier);
  3933.         }
  3934.           else if (TREE_CODE (init) == STRING_CST
  3935.                && i < TREE_STRING_LENGTH (init))
  3936.         {
  3937.           temp = GEN_INT (TREE_STRING_POINTER (init)[i]);
  3938.           return convert_to_mode (mode, temp, 0);
  3939.         }
  3940.         }
  3941.     }
  3942.       /* Treat array-ref with constant index as a component-ref.  */
  3943.  
  3944.     case COMPONENT_REF:
  3945.     case BIT_FIELD_REF:
  3946.       /* If the operand is a CONSTRUCTOR, we can just extract the
  3947.      appropriate field if it is present.  */
  3948.       if (code != ARRAY_REF
  3949.       && TREE_CODE (TREE_OPERAND (exp, 0)) == CONSTRUCTOR)
  3950.     {
  3951.       tree elt;
  3952.  
  3953.       for (elt = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0)); elt;
  3954.            elt = TREE_CHAIN (elt))
  3955.         if (TREE_PURPOSE (elt) == TREE_OPERAND (exp, 1))
  3956.           return expand_expr (TREE_VALUE (elt), target, tmode, modifier);
  3957.     }
  3958.  
  3959.       {
  3960.     enum machine_mode mode1;
  3961.     int bitsize;
  3962.     int bitpos;
  3963.     tree offset;
  3964.     int volatilep = 0;
  3965.     tree tem = get_inner_reference (exp, &bitsize, &bitpos, &offset,
  3966.                     &mode1, &unsignedp, &volatilep);
  3967.  
  3968.     /* In some cases, we will be offsetting OP0's address by a constant.
  3969.        So get it as a sum, if possible.  If we will be using it
  3970.        directly in an insn, we validate it.  */
  3971.     op0 = expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_SUM);
  3972.  
  3973.     /* If this is a constant, put it into a register if it is a
  3974.        legimate constant and memory if it isn't.  */
  3975.     if (CONSTANT_P (op0))
  3976.       {
  3977.         enum machine_mode mode = TYPE_MODE (TREE_TYPE (tem));
  3978.         if (LEGITIMATE_CONSTANT_P (op0))
  3979.           op0 = force_reg (mode, op0);
  3980.         else
  3981.           op0 = validize_mem (force_const_mem (mode, op0));
  3982.       }
  3983.  
  3984.     if (offset != 0)
  3985.       {
  3986.         rtx offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, 0);
  3987.  
  3988.         if (GET_CODE (op0) != MEM)
  3989.           abort ();
  3990.         op0 = change_address (op0, VOIDmode,
  3991.                   gen_rtx (PLUS, DPmode, XEXP (op0, 0),
  3992.                        force_reg (DPmode, offset_rtx)));
  3993.       }
  3994.  
  3995.     /* Don't forget about volatility even if this is a bitfield.  */
  3996.     if (GET_CODE (op0) == MEM && volatilep && ! MEM_VOLATILE_P (op0))
  3997.       {
  3998.         op0 = copy_rtx (op0);
  3999.         MEM_VOLATILE_P (op0) = 1;
  4000.       }
  4001.  
  4002.     if (mode1 == VOIDmode
  4003.         || (mode1 != BLKmode && ! direct_load[(int) mode1]
  4004.         && modifier != EXPAND_CONST_ADDRESS
  4005.         && modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
  4006.         || GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG)
  4007.       {
  4008.         /* In cases where an aligned union has an unaligned object
  4009.            as a field, we might be extracting a BLKmode value from
  4010.            an integer-mode (e.g., SImode) object.  Handle this case
  4011.            by doing the extract into an object as wide as the field
  4012.            (which we know to be the width of a basic mode), then
  4013.            storing into memory, and changing the mode to BLKmode.  */
  4014.         enum machine_mode ext_mode = mode;
  4015.  
  4016.         if (ext_mode == BLKmode)
  4017.           ext_mode = mode_for_size (bitsize, MODE_INT, 1);
  4018.  
  4019.         if (ext_mode == BLKmode)
  4020.           abort ();
  4021.  
  4022.         op0 = extract_bit_field (validize_mem (op0), bitsize, bitpos,
  4023.                      unsignedp, target, ext_mode, ext_mode,
  4024.                      TYPE_ALIGN (TREE_TYPE (tem)) / BITS_PER_UNIT,
  4025.                      int_size_in_bytes (TREE_TYPE (tem)));
  4026.         if (mode == BLKmode)
  4027.           {
  4028.         rtx new = assign_stack_temp (ext_mode,
  4029.                          bitsize / BITS_PER_UNIT, 0);
  4030.  
  4031.         emit_move_insn (new, op0);
  4032.         op0 = copy_rtx (new);
  4033.         PUT_MODE (op0, BLKmode);
  4034.           }
  4035.  
  4036.         return op0;
  4037.       }
  4038.  
  4039.     /* Get a reference to just this component.  */
  4040.     if (modifier == EXPAND_CONST_ADDRESS
  4041.         || modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER)
  4042.       op0 = gen_rtx (MEM, mode1, plus_constant (XEXP (op0, 0),
  4043.                             (bitpos / BITS_PER_UNIT)));
  4044.     else
  4045.       op0 = change_address (op0, mode1,
  4046.                 plus_constant (XEXP (op0, 0),
  4047.                            (bitpos / BITS_PER_UNIT)));
  4048.     MEM_IN_STRUCT_P (op0) = 1;
  4049.     MEM_VOLATILE_P (op0) |= volatilep;
  4050.     if (mode == mode1 || mode1 == BLKmode || mode1 == tmode)
  4051.       return op0;
  4052.     if (target == 0)
  4053.       target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
  4054.     convert_move (target, op0, unsignedp);
  4055.     return target;
  4056.       }
  4057.  
  4058.     case OFFSET_REF:
  4059.       {
  4060.     tree base = build_unary_op (ADDR_EXPR, TREE_OPERAND (exp, 0), 0);
  4061.     tree addr = build (PLUS_EXPR, type, base, TREE_OPERAND (exp, 1));
  4062.     op0 = expand_expr (addr, NULL_RTX, VOIDmode, EXPAND_SUM);
  4063.     temp = gen_rtx (MEM, mode, memory_address (mode, op0));
  4064.     MEM_IN_STRUCT_P (temp) = 1;
  4065.     MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) || flag_volatile;
  4066. #if 0 /* It is incorrectto set RTX_UNCHANGING_P here, because the fact that
  4067.      a location is accessed through a pointer to const does not mean
  4068.      that the value there can never change.  */
  4069.     RTX_UNCHANGING_P (temp) = TREE_READONLY (exp);
  4070. #endif
  4071.     return temp;
  4072.       }
  4073.  
  4074.       /* Intended for a reference to a buffer of a file-object in Pascal.
  4075.      But it's not certain that a special tree code will really be
  4076.      necessary for these.  INDIRECT_REF might work for them.  */
  4077.     case BUFFER_REF:
  4078.       abort ();
  4079.  
  4080.     /* IN_EXPR: Inlined pascal set IN expression.
  4081.  
  4082.        Algorithm:
  4083.          rlo       = set_low - (set_low%bits_per_word);
  4084.      the_word  = set [ (index - rlo)/bits_per_word ];
  4085.      bit_index = index % bits_per_word;
  4086.      bitmask   = 1 << bit_index;
  4087.      return !!(the_word & bitmask);  */
  4088.     case IN_EXPR:
  4089.       preexpand_calls (exp);
  4090.       {
  4091.     tree set = TREE_OPERAND (exp, 0);
  4092.     tree index = TREE_OPERAND (exp, 1);
  4093.     tree set_type = TREE_TYPE (set);
  4094.  
  4095.     tree set_low_bound = TYPE_MIN_VALUE (TYPE_DOMAIN (set_type));
  4096.     tree set_high_bound = TYPE_MAX_VALUE (TYPE_DOMAIN (set_type));
  4097.  
  4098.     rtx index_val;
  4099.     rtx lo_r;
  4100.     rtx hi_r;
  4101.     rtx rlow;
  4102.     rtx diff, quo, rem, addr, bit, result;
  4103.     rtx setval, setaddr;
  4104.     enum machine_mode index_mode = TYPE_MODE (TREE_TYPE (index));
  4105.  
  4106.     if (target == 0)
  4107.       target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
  4108.  
  4109.     /* If domain is empty, answer is no.  */
  4110.     if (tree_int_cst_lt (set_high_bound, set_low_bound))
  4111.       return const0_rtx;
  4112.  
  4113.     index_val = expand_expr (index, 0, VOIDmode, 0);
  4114.     lo_r = expand_expr (set_low_bound, 0, VOIDmode, 0);
  4115.     hi_r = expand_expr (set_high_bound, 0, VOIDmode, 0);
  4116.     setval = expand_expr (set, 0, VOIDmode, 0);
  4117.     setaddr = XEXP (setval, 0); 
  4118.  
  4119.     /* Compare index against bounds, if they are constant.  */
  4120.     if (GET_CODE (index_val) == CONST_INT
  4121.         && GET_CODE (lo_r) == CONST_INT)
  4122.       {
  4123.         if (INTVAL (index_val) < INTVAL (lo_r))
  4124.           return const0_rtx;
  4125.       }
  4126.  
  4127.     if (GET_CODE (index_val) == CONST_INT
  4128.         && GET_CODE (hi_r) == CONST_INT)
  4129.       {
  4130.         if (INTVAL (hi_r) < INTVAL (index_val))
  4131.           return const0_rtx;
  4132.       }
  4133.  
  4134.     /* If we get here, we have to generate the code for both cases
  4135.        (in range and out of range).  */
  4136.  
  4137.     op0 = gen_label_rtx ();
  4138.     op1 = gen_label_rtx ();
  4139.  
  4140.     if (! (GET_CODE (index_val) == CONST_INT
  4141.            && GET_CODE (lo_r) == CONST_INT))
  4142.       {
  4143.         emit_cmp_insn (index_val, lo_r, LT, 0, GET_MODE (index_val), 0, 0);
  4144.         emit_jump_insn (gen_blt (op1));
  4145.       }
  4146.  
  4147.     if (! (GET_CODE (index_val) == CONST_INT
  4148.            && GET_CODE (hi_r) == CONST_INT))
  4149.       {
  4150.         emit_cmp_insn (index_val, hi_r, GT, 0, GET_MODE (index_val), 0, 0);
  4151.         emit_jump_insn (gen_bgt (op1));
  4152.       }
  4153.  
  4154.     /* Calculate the element number of bit zero in the first word
  4155.        of the set.  */
  4156.     if (GET_CODE (lo_r) == CONST_INT)
  4157.       rlow = gen_rtx (CONST_INT, VOIDmode,
  4158.               INTVAL (lo_r) & ~ (1 << BITS_PER_UNIT));
  4159.     else
  4160.       rlow = expand_binop (index_mode, and_optab,
  4161.                    lo_r, gen_rtx (CONST_INT, VOIDmode,
  4162.                           ~ (1 << BITS_PER_UNIT)),
  4163.                    0, 0, OPTAB_LIB_WIDEN);
  4164.  
  4165.     diff = expand_binop (index_mode, sub_optab,
  4166.                  index_val, rlow, 0, 0, OPTAB_LIB_WIDEN);
  4167.  
  4168.     quo = expand_divmod (0, TRUNC_DIV_EXPR, index_mode, diff,
  4169.                  gen_rtx (CONST_INT, VOIDmode, BITS_PER_UNIT),
  4170.                  0, 0);
  4171.     rem = expand_divmod (1, TRUNC_MOD_EXPR, index_mode, index_val,
  4172.                  gen_rtx (CONST_INT, VOIDmode, BITS_PER_UNIT),
  4173.                  0, 0);
  4174.     addr = memory_address (byte_mode,
  4175.                    expand_binop (index_mode, add_optab,
  4176.                          diff, setaddr));
  4177.     /* Extract the bit we want to examine */
  4178.     bit = expand_shift (RSHIFT_EXPR, byte_mode,
  4179.                 gen_rtx (MEM, byte_mode, addr), rem, 0, 1);
  4180.     result = expand_binop (SImode, and_optab, bit, const1_rtx, target,
  4181.                    1, OPTAB_LIB_WIDEN);
  4182.     emit_move_insn (target, result);
  4183.  
  4184.     /* Output the code to handle the out-of-range case.  */
  4185.     emit_jump (op0);
  4186.     emit_label (op1);
  4187.     emit_move_insn (target, const0_rtx);
  4188.     emit_label (op0);
  4189.     return target;
  4190.       }
  4191.  
  4192.     case WITH_CLEANUP_EXPR:
  4193.       if (RTL_EXPR_RTL (exp) == 0)
  4194.     {
  4195.       RTL_EXPR_RTL (exp)
  4196.         = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
  4197.       cleanups_this_call
  4198.         = tree_cons (NULL_TREE, TREE_OPERAND (exp, 2), cleanups_this_call);
  4199.       /* That's it for this cleanup.  */
  4200.       TREE_OPERAND (exp, 2) = 0;
  4201.     }
  4202.       return RTL_EXPR_RTL (exp);
  4203.  
  4204.     case CALL_EXPR:
  4205.       /* Check for a built-in function.  */
  4206.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
  4207.       && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == FUNCTION_DECL
  4208.       && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  4209.     return expand_builtin (exp, target, subtarget, tmode, ignore);
  4210.       /* If this call was expanded already by preexpand_calls,
  4211.      just return the result we got.  */
  4212.       if (CALL_EXPR_RTL (exp) != 0)
  4213.     return CALL_EXPR_RTL (exp);
  4214.       return expand_call (exp, target, ignore);
  4215.  
  4216.     case NON_LVALUE_EXPR:
  4217.     case NOP_EXPR:
  4218.     case CONVERT_EXPR:
  4219.     case REFERENCE_EXPR:
  4220.       if (TREE_CODE (type) == VOID_TYPE || ignore)
  4221.     {
  4222.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, modifier);
  4223.       return const0_rtx;
  4224.     }
  4225.       if (mode == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  4226.     return expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, modifier);
  4227.       if (TREE_CODE (type) == UNION_TYPE)
  4228.     {
  4229.       tree valtype = TREE_TYPE (TREE_OPERAND (exp, 0));
  4230.       if (target == 0)
  4231.         {
  4232.           if (mode == BLKmode)
  4233.         {
  4234.           if (TYPE_SIZE (type) == 0
  4235.               || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
  4236.             abort ();
  4237.           target = assign_stack_temp (BLKmode,
  4238.                           (TREE_INT_CST_LOW (TYPE_SIZE (type))
  4239.                            + BITS_PER_UNIT - 1)
  4240.                           / BITS_PER_UNIT, 0);
  4241.         }
  4242.           else
  4243.         target = gen_reg_rtx (mode);
  4244.         }
  4245.       if (GET_CODE (target) == MEM)
  4246.         /* Store data into beginning of memory target.  */
  4247.         store_expr (TREE_OPERAND (exp, 0),
  4248.             change_address (target, TYPE_MODE (valtype), 0), 0);
  4249.  
  4250.       else if (GET_CODE (target) == REG)
  4251.         /* Store this field into a union of the proper type.  */
  4252.         store_field (target, GET_MODE_BITSIZE (TYPE_MODE (valtype)), 0,
  4253.              TYPE_MODE (valtype), TREE_OPERAND (exp, 0),
  4254.              VOIDmode, 0, 1,
  4255.              int_size_in_bytes (TREE_TYPE (TREE_OPERAND (exp, 0))));
  4256.       else
  4257.         abort ();
  4258.  
  4259.       /* Return the entire union.  */
  4260.       return target;
  4261.     }
  4262.       op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, 0);
  4263.       if (GET_MODE (op0) == mode || GET_MODE (op0) == VOIDmode)
  4264.     return op0;
  4265.       if (modifier == EXPAND_INITIALIZER)
  4266.     return gen_rtx (unsignedp ? ZERO_EXTEND : SIGN_EXTEND, mode, op0);
  4267.       if (flag_force_mem && GET_CODE (op0) == MEM)
  4268.     op0 = copy_to_reg (op0);
  4269.  
  4270.       if (target == 0)
  4271.     return convert_to_mode (mode, op0, TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
  4272.       else
  4273.     convert_move (target, op0, TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
  4274.       return target;
  4275.  
  4276.     case PLUS_EXPR:
  4277.       /* We come here from MINUS_EXPR when the second operand is a constant. */
  4278.     plus_expr:
  4279.       this_optab = add_optab;
  4280.  
  4281.       /* If we are adding a constant, an RTL_EXPR that is sp, fp, or ap, and
  4282.      something else, make sure we add the register to the constant and
  4283.      then to the other thing.  This case can occur during strength
  4284.      reduction and doing it this way will produce better code if the
  4285.      frame pointer or argument pointer is eliminated.
  4286.  
  4287.      fold-const.c will ensure that the constant is always in the inner
  4288.      PLUS_EXPR, so the only case we need to do anything about is if
  4289.      sp, ap, or fp is our second argument, in which case we must swap
  4290.      the innermost first argument and our second argument.  */
  4291.  
  4292.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
  4293.       && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 1)) == INTEGER_CST
  4294.       && TREE_CODE (TREE_OPERAND (exp, 1)) == RTL_EXPR
  4295.       && (RTL_EXPR_RTL (TREE_OPERAND (exp, 1)) == frame_pointer_rtx
  4296.           || RTL_EXPR_RTL (TREE_OPERAND (exp, 1)) == stack_pointer_rtx
  4297.           || RTL_EXPR_RTL (TREE_OPERAND (exp, 1)) == arg_pointer_rtx))
  4298.     {
  4299.       tree t = TREE_OPERAND (exp, 1);
  4300.  
  4301.       TREE_OPERAND (exp, 1) = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
  4302.       TREE_OPERAND (TREE_OPERAND (exp, 0), 0) = t;
  4303.     }
  4304.  
  4305.       /* If the result is to be Pmode and we are adding an integer to
  4306.      something, we might be forming a constant.  So try to use
  4307.      plus_constant.  If it produces a sum and we can't accept it,
  4308.      use force_operand.  This allows P = &ARR[const] to generate
  4309.      efficient code on machines where a SYMBOL_REF is not a valid
  4310.      address.
  4311.  
  4312.      If this is an EXPAND_SUM call, always return the sum.  */
  4313.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST
  4314.       && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
  4315.       && (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER
  4316.           || mode == DPmode))
  4317.     {
  4318.       op1 = expand_expr (TREE_OPERAND (exp, 1), subtarget, VOIDmode,
  4319.                  EXPAND_SUM);
  4320.       op1 = plus_constant (op1, TREE_INT_CST_LOW (TREE_OPERAND (exp, 0)));
  4321.       if (modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
  4322.         op1 = force_operand (op1, target);
  4323.       return op1;
  4324.     }
  4325.  
  4326.       else if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  4327.            && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_INT
  4328.            && (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER
  4329.            || mode == DPmode))
  4330.     {
  4331.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode,
  4332.                  EXPAND_SUM);
  4333.       op0 = plus_constant (op0, TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)));
  4334.       if (modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
  4335.         op0 = force_operand (op0, target);
  4336.       return op0;
  4337.     }
  4338.  
  4339.       /* No sense saving up arithmetic to be done
  4340.      if it's all in the wrong mode to form part of an address.
  4341.      And force_operand won't know whether to sign-extend or
  4342.      zero-extend.  */
  4343.       if ((modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
  4344.       || mode != DPmode) goto binop;
  4345.       preexpand_calls (exp);
  4346.       if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  4347.     subtarget = 0;
  4348.  
  4349.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, modifier);
  4350.       op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, modifier);
  4351.  
  4352.       /* Make sure any term that's a sum with a constant comes last.  */
  4353.       if (GET_CODE (op0) == PLUS
  4354.       && CONSTANT_P (XEXP (op0, 1)))
  4355.     {
  4356.       temp = op0;
  4357.       op0 = op1;
  4358.       op1 = temp;
  4359.     }
  4360.       /* If adding to a sum including a constant,
  4361.      associate it to put the constant outside.  */
  4362.       if (GET_CODE (op1) == PLUS
  4363.       && CONSTANT_P (XEXP (op1, 1)))
  4364.     {
  4365.       rtx constant_term = const0_rtx;
  4366.  
  4367.       temp = simplify_binary_operation (PLUS, mode, XEXP (op1, 0), op0);
  4368.       if (temp != 0)
  4369.         op0 = temp;
  4370.       /* Ensure that MULT comes first if there is one.  */
  4371.       else if (GET_CODE (op0) == MULT)
  4372.         op0 = gen_rtx (PLUS, mode, op0, XEXP (op1, 0));
  4373.       else
  4374.         op0 = gen_rtx (PLUS, mode, XEXP (op1, 0), op0);
  4375.  
  4376.       /* Let's also eliminate constants from op0 if possible.  */
  4377.       op0 = eliminate_constant_term (op0, &constant_term);
  4378.  
  4379.       /* CONSTANT_TERM and XEXP (op1, 1) are known to be constant, so
  4380.          their sum should be a constant.  Form it into OP1, since the 
  4381.          result we want will then be OP0 + OP1.  */
  4382.  
  4383.       temp = simplify_binary_operation (PLUS, mode, constant_term,
  4384.                         XEXP (op1, 1));
  4385.       if (temp != 0)
  4386.         op1 = temp;
  4387.       else
  4388.         op1 = gen_rtx (PLUS, mode, constant_term, XEXP (op1, 1));
  4389.     }
  4390.  
  4391.       /* Put a constant term last and put a multiplication first.  */
  4392.       if (CONSTANT_P (op0) || GET_CODE (op1) == MULT)
  4393.     temp = op1, op1 = op0, op0 = temp;
  4394.  
  4395.       temp = simplify_binary_operation (PLUS, mode, op0, op1);
  4396.       return temp ? temp : gen_rtx (PLUS, mode, op0, op1);
  4397.  
  4398.     case MINUS_EXPR:
  4399.       /* Handle difference of two symbolic constants,
  4400.      for the sake of an initializer.  */
  4401.       if ((modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER)
  4402.       && really_constant_p (TREE_OPERAND (exp, 0))
  4403.       && really_constant_p (TREE_OPERAND (exp, 1)))
  4404.     {
  4405.       rtx op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX,
  4406.                  VOIDmode, modifier);
  4407.       rtx op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX,
  4408.                  VOIDmode, modifier);
  4409.       return gen_rtx (MINUS, mode, op0, op1);
  4410.     }
  4411.       /* Convert A - const to A + (-const).  */
  4412.       if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
  4413.     {
  4414.       exp = build (PLUS_EXPR, type, TREE_OPERAND (exp, 0),
  4415.                fold (build1 (NEGATE_EXPR, type,
  4416.                      TREE_OPERAND (exp, 1))));
  4417.       goto plus_expr;
  4418.     }
  4419.       this_optab = sub_optab;
  4420.       goto binop;
  4421.  
  4422.     case MULT_EXPR:
  4423.       preexpand_calls (exp);
  4424.       /* If first operand is constant, swap them.
  4425.      Thus the following special case checks need only
  4426.      check the second operand.  */
  4427.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST)
  4428.     {
  4429.       register tree t1 = TREE_OPERAND (exp, 0);
  4430.       TREE_OPERAND (exp, 0) = TREE_OPERAND (exp, 1);
  4431.       TREE_OPERAND (exp, 1) = t1;
  4432.     }
  4433.  
  4434.       /* Attempt to return something suitable for generating an
  4435.      indexed address, for machines that support that.  */
  4436.  
  4437.       if (modifier == EXPAND_SUM && mode == DPmode
  4438.       && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  4439.       && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
  4440.     {
  4441.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
  4442.  
  4443.       /* Apply distributive law if OP0 is x+c.  */
  4444.       if (GET_CODE (op0) == PLUS
  4445.           && GET_CODE (XEXP (op0, 1)) == CONST_INT)
  4446.         return gen_rtx (PLUS, mode,
  4447.                 gen_rtx (MULT, mode, XEXP (op0, 0),
  4448.                      GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)))),
  4449.                 GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))
  4450.                      * INTVAL (XEXP (op0, 1))));
  4451.  
  4452.       if (GET_CODE (op0) != REG)
  4453.         op0 = force_operand (op0, NULL_RTX);
  4454.       if (GET_CODE (op0) != REG)
  4455. #if 0/*defined(APPLE_HAX) && defined(PTR_HACK)*/
  4456.        if(GET_MODE(op0) != mode) {
  4457.          op0 = copy_to_mode_reg (mode, convert_to_mode(mode, op0, 0));
  4458.        } else {
  4459.         op0 = copy_to_mode_reg (mode, op0);
  4460.        }
  4461. #else
  4462.         op0 = copy_to_mode_reg (mode, op0);
  4463. #endif
  4464.       return gen_rtx (MULT, mode, op0,
  4465.               GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))));
  4466.     }
  4467.  
  4468.       if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  4469.     subtarget = 0;
  4470.  
  4471.       /* Check for multiplying things that have been extended
  4472.      from a narrower type.  If this machine supports multiplying
  4473.      in that narrower type with a result in the desired type,
  4474.      do it that way, and avoid the explicit type-conversion.  */
  4475.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == NOP_EXPR
  4476.       && TREE_CODE (type) == INTEGER_TYPE
  4477.       && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  4478.           < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0))))
  4479.       && ((TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  4480.            && int_fits_type_p (TREE_OPERAND (exp, 1),
  4481.                    TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  4482.            /* Don't use a widening multiply if a shift will do.  */
  4483.            && ((GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1))))
  4484.             > HOST_BITS_PER_WIDE_INT)
  4485.            || exact_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))) < 0))
  4486.           ||
  4487.           (TREE_CODE (TREE_OPERAND (exp, 1)) == NOP_EXPR
  4488.            && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
  4489.            ==
  4490.            TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))))
  4491.            /* If both operands are extended, they must either both
  4492.           be zero-extended or both be sign-extended.  */
  4493.            && (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
  4494.            ==
  4495.            TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))))))
  4496.     {
  4497.       enum machine_mode innermode
  4498.         = TYPE_MODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)));
  4499.       this_optab = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  4500.             ? umul_widen_optab : smul_widen_optab);
  4501.       if (mode == GET_MODE_WIDER_MODE (innermode)
  4502.           && this_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  4503.         {
  4504.           op0 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
  4505.                  NULL_RTX, VOIDmode, 0);
  4506.           if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
  4507.         op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX,
  4508.                    VOIDmode, 0);
  4509.           else
  4510.         op1 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 1), 0),
  4511.                    NULL_RTX, VOIDmode, 0);
  4512.           goto binop2;
  4513.         }
  4514.     }
  4515.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4516.       op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  4517.       return expand_mult (mode, op0, op1, target, unsignedp);
  4518.  
  4519.     case TRUNC_DIV_EXPR:
  4520.     case FLOOR_DIV_EXPR:
  4521.     case CEIL_DIV_EXPR:
  4522.     case ROUND_DIV_EXPR:
  4523.     case EXACT_DIV_EXPR:
  4524.       preexpand_calls (exp);
  4525.       if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  4526.     subtarget = 0;
  4527.       /* Possible optimization: compute the dividend with EXPAND_SUM
  4528.      then if the divisor is constant can optimize the case
  4529.      where some terms of the dividend have coeffs divisible by it.  */
  4530.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4531.       op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  4532.       return expand_divmod (0, code, mode, op0, op1, target, unsignedp);
  4533.  
  4534.     case RDIV_EXPR:
  4535.       this_optab = flodiv_optab;
  4536.       goto binop;
  4537.  
  4538.     case TRUNC_MOD_EXPR:
  4539.     case FLOOR_MOD_EXPR:
  4540.     case CEIL_MOD_EXPR:
  4541.     case ROUND_MOD_EXPR:
  4542.       preexpand_calls (exp);
  4543.       if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  4544.     subtarget = 0;
  4545.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4546.       op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  4547.       return expand_divmod (1, code, mode, op0, op1, target, unsignedp);
  4548.  
  4549.     case FIX_ROUND_EXPR:
  4550.     case FIX_FLOOR_EXPR:
  4551.     case FIX_CEIL_EXPR:
  4552.       abort ();            /* Not used for C.  */
  4553.  
  4554.     case FIX_TRUNC_EXPR:
  4555.       op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
  4556.       if (target == 0)
  4557.     target = gen_reg_rtx (mode);
  4558.       expand_fix (target, op0, unsignedp);
  4559.       return target;
  4560.  
  4561.     case FLOAT_EXPR:
  4562.       op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
  4563.       if (target == 0)
  4564.     target = gen_reg_rtx (mode);
  4565.       /* expand_float can't figure out what to do if FROM has VOIDmode.
  4566.      So give it the correct mode.  With -O, cse will optimize this.  */
  4567.       if (GET_MODE (op0) == VOIDmode)
  4568.     op0 = copy_to_mode_reg (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))),
  4569.                 op0);
  4570.       expand_float (target, op0,
  4571.             TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
  4572.       return target;
  4573.  
  4574.     case NEGATE_EXPR:
  4575.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  4576.       temp = expand_unop (mode, neg_optab, op0, target, 0);
  4577.       if (temp == 0)
  4578.     abort ();
  4579.       return temp;
  4580.  
  4581.     case ABS_EXPR:
  4582.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4583.  
  4584.       /* Handle complex values specially.  */
  4585.       {
  4586.     enum machine_mode opmode
  4587.       = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
  4588.  
  4589.     if (GET_MODE_CLASS (opmode) == MODE_COMPLEX_INT
  4590.         || GET_MODE_CLASS (opmode) == MODE_COMPLEX_FLOAT)
  4591.       return expand_complex_abs (opmode, op0, target, unsignedp);
  4592.       }
  4593.  
  4594.       /* Unsigned abs is simply the operand.  Testing here means we don't
  4595.      risk generating incorrect code below.  */
  4596.       if (TREE_UNSIGNED (type))
  4597.     return op0;
  4598.  
  4599.       /* First try to do it with a special abs instruction.  */
  4600.       temp = expand_unop (mode, abs_optab, op0, target, 0);
  4601.       if (temp != 0)
  4602.     return temp;
  4603.  
  4604.       /* If this machine has expensive jumps, we can do integer absolute
  4605.      value of X as (((signed) x >> (W-1)) ^ x) - ((signed) x >> (W-1)),
  4606.      where W is the width of MODE.  */
  4607. #ifdef MPW
  4608. #define extended Extended
  4609. #endif
  4610.       if (GET_MODE_CLASS (mode) == MODE_INT && BRANCH_COST >= 2)
  4611.     {
  4612.       rtx extended = expand_shift (RSHIFT_EXPR, mode, op0,
  4613.                        size_int (GET_MODE_BITSIZE (mode) - 1),
  4614.                        NULL_RTX, 0);
  4615.  
  4616.       temp = expand_binop (mode, xor_optab, extended, op0, target, 0,
  4617.                    OPTAB_LIB_WIDEN);
  4618.       if (temp != 0)
  4619.         temp = expand_binop (mode, sub_optab, temp, extended, target, 0,
  4620.                  OPTAB_LIB_WIDEN);
  4621.  
  4622.       if (temp != 0)
  4623.         return temp;
  4624.     }
  4625. #ifdef MPW
  4626. #undef extended
  4627. #endif
  4628.  
  4629.       /* If that does not win, use conditional jump and negate.  */
  4630.       target = original_target;
  4631.       temp = gen_label_rtx ();
  4632.       if (target == 0 || ! safe_from_p (target, TREE_OPERAND (exp, 0))
  4633.       || (GET_CODE (target) == REG
  4634.           && REGNO (target) < FIRST_PSEUDO_REGISTER))
  4635.     target = gen_reg_rtx (mode);
  4636.       emit_move_insn (target, op0);
  4637.       emit_cmp_insn (target,
  4638.              expand_expr (convert (type, integer_zero_node),
  4639.                   NULL_RTX, VOIDmode, 0),
  4640.              GE, NULL_RTX, mode, 0, 0);
  4641.       NO_DEFER_POP;
  4642.       emit_jump_insn (gen_bge (temp));
  4643.       op0 = expand_unop (mode, neg_optab, target, target, 0);
  4644.       if (op0 != target)
  4645.     emit_move_insn (target, op0);
  4646.       emit_label (temp);
  4647.       OK_DEFER_POP;
  4648.       return target;
  4649.  
  4650.     case MAX_EXPR:
  4651.     case MIN_EXPR:
  4652.       target = original_target;
  4653.       if (target == 0 || ! safe_from_p (target, TREE_OPERAND (exp, 1))
  4654.       || (GET_CODE (target) == REG
  4655.           && REGNO (target) < FIRST_PSEUDO_REGISTER))
  4656.     target = gen_reg_rtx (mode);
  4657.       op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  4658.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  4659.  
  4660.       /* First try to do it with a special MIN or MAX instruction.
  4661.      If that does not win, use a conditional jump to select the proper
  4662.      value.  */
  4663.       this_optab = (TREE_UNSIGNED (type)
  4664.             ? (code == MIN_EXPR ? umin_optab : umax_optab)
  4665.             : (code == MIN_EXPR ? smin_optab : smax_optab));
  4666.  
  4667.       temp = expand_binop (mode, this_optab, op0, op1, target, unsignedp,
  4668.                OPTAB_WIDEN);
  4669.       if (temp != 0)
  4670.     return temp;
  4671.  
  4672.       if (target != op0)
  4673.     emit_move_insn (target, op0);
  4674.       op0 = gen_label_rtx ();
  4675.       if (code == MAX_EXPR)
  4676.     temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
  4677.         ? compare_from_rtx (target, op1, GEU, 1, mode, NULL_RTX, 0)
  4678.         : compare_from_rtx (target, op1, GE, 0, mode, NULL_RTX, 0));
  4679.       else
  4680.     temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
  4681.         ? compare_from_rtx (target, op1, LEU, 1, mode, NULL_RTX, 0)
  4682.         : compare_from_rtx (target, op1, LE, 0, mode, NULL_RTX, 0));
  4683.       if (temp == const0_rtx)
  4684.     emit_move_insn (target, op1);
  4685.       else if (temp != const_true_rtx)
  4686.     {
  4687.       if (bcc_gen_fctn[(int) GET_CODE (temp)] != 0)
  4688.         emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (temp)]) (op0));
  4689.       else
  4690.         abort ();
  4691.       emit_move_insn (target, op1);
  4692.     }
  4693.       emit_label (op0);
  4694.       return target;
  4695.  
  4696. /* ??? Can optimize when the operand of this is a bitwise operation,
  4697.    by using a different bitwise operation.  */
  4698.     case BIT_NOT_EXPR:
  4699.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4700.       temp = expand_unop (mode, one_cmpl_optab, op0, target, 1);
  4701.       if (temp == 0)
  4702.     abort ();
  4703.       return temp;
  4704.  
  4705.     case FFS_EXPR:
  4706.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4707.       temp = expand_unop (mode, ffs_optab, op0, target, 1);
  4708.       if (temp == 0)
  4709.     abort ();
  4710.       return temp;
  4711.  
  4712. /* ??? Can optimize bitwise operations with one arg constant.
  4713.    Can optimize (a bitwise1 n) bitwise2 (a bitwise3 b)
  4714.    and (a bitwise1 b) bitwise2 b (etc)
  4715.    but that is probably not worth while.  */
  4716.  
  4717. /* BIT_AND_EXPR is for bitwise anding.
  4718.    TRUTH_AND_EXPR is for anding two boolean values
  4719.    when we want in all cases to compute both of them.
  4720.    In general it is fastest to do TRUTH_AND_EXPR by
  4721.    computing both operands as actual zero-or-1 values
  4722.    and then bitwise anding.  In cases where there cannot
  4723.    be any side effects, better code would be made by
  4724.    treating TRUTH_AND_EXPR like TRUTH_ANDIF_EXPR;
  4725.    but the question is how to recognize those cases.  */
  4726.  
  4727.     case TRUTH_AND_EXPR:
  4728.     case BIT_AND_EXPR:
  4729.       this_optab = and_optab;
  4730.       goto binop;
  4731.  
  4732. /* See comment above about TRUTH_AND_EXPR; it applies here too.  */
  4733.     case TRUTH_OR_EXPR:
  4734.     case BIT_IOR_EXPR:
  4735.       this_optab = ior_optab;
  4736.       goto binop;
  4737.  
  4738.     case BIT_XOR_EXPR:
  4739.       this_optab = xor_optab;
  4740.       goto binop;
  4741.  
  4742.     case LSHIFT_EXPR:
  4743.     case RSHIFT_EXPR:
  4744.     case LROTATE_EXPR:
  4745.     case RROTATE_EXPR:
  4746.       preexpand_calls (exp);
  4747.       if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  4748.     subtarget = 0;
  4749.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4750.       return expand_shift (code, mode, op0, TREE_OPERAND (exp, 1), target,
  4751.                unsignedp);
  4752.  
  4753. /* Could determine the answer when only additive constants differ.
  4754.    Also, the addition of one can be handled by changing the condition.  */
  4755.     case LT_EXPR:
  4756.     case LE_EXPR:
  4757.     case GT_EXPR:
  4758.     case GE_EXPR:
  4759.     case EQ_EXPR:
  4760.     case NE_EXPR:
  4761.       preexpand_calls (exp);
  4762.       temp = do_store_flag (exp, target, tmode != VOIDmode ? tmode : mode, 0);
  4763.       if (temp != 0)
  4764.     return temp;
  4765.       /* For foo != 0, load foo, and if it is nonzero load 1 instead. */
  4766.       if (code == NE_EXPR && integer_zerop (TREE_OPERAND (exp, 1))
  4767.       && original_target
  4768.       && GET_CODE (original_target) == REG
  4769.       && (GET_MODE (original_target)
  4770.           == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  4771.     {
  4772.       temp = expand_expr (TREE_OPERAND (exp, 0), original_target, VOIDmode, 0);
  4773.       if (temp != original_target)
  4774.         temp = copy_to_reg (temp);
  4775.       op1 = gen_label_rtx ();
  4776.       emit_cmp_insn (temp, const0_rtx, EQ, NULL_RTX,
  4777.              GET_MODE (temp), unsignedp, 0);
  4778.       emit_jump_insn (gen_beq (op1));
  4779.       emit_move_insn (temp, const1_rtx);
  4780.       emit_label (op1);
  4781.       return temp;
  4782.     }
  4783.       /* If no set-flag instruction, must generate a conditional
  4784.      store into a temporary variable.  Drop through
  4785.      and handle this like && and ||.  */
  4786.  
  4787.     case TRUTH_ANDIF_EXPR:
  4788.     case TRUTH_ORIF_EXPR:
  4789.       if (target == 0 || ! safe_from_p (target, exp)
  4790.       /* Make sure we don't have a hard reg (such as function's return
  4791.          value) live across basic blocks, if not optimizing.  */
  4792.       || (!optimize && GET_CODE (target) == REG
  4793.           && REGNO (target) < FIRST_PSEUDO_REGISTER))
  4794.     target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
  4795.       emit_clr_insn (target);
  4796.       op1 = gen_label_rtx ();
  4797.       jumpifnot (exp, op1);
  4798.       emit_0_to_1_insn (target);
  4799.       emit_label (op1);
  4800.       return target;
  4801.  
  4802.     case TRUTH_NOT_EXPR:
  4803.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  4804.       /* The parser is careful to generate TRUTH_NOT_EXPR
  4805.      only with operands that are always zero or one.  */
  4806.       temp = expand_binop (mode, xor_optab, op0, const1_rtx,
  4807.                target, 1, OPTAB_LIB_WIDEN);
  4808.       if (temp == 0)
  4809.     abort ();
  4810.       return temp;
  4811.  
  4812.     case COMPOUND_EXPR:
  4813.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
  4814.       emit_queue ();
  4815.       return expand_expr (TREE_OPERAND (exp, 1),
  4816.               (ignore ? const0_rtx : target),
  4817.               VOIDmode, 0);
  4818.  
  4819.     case COND_EXPR:
  4820.       {
  4821.     /* Note that COND_EXPRs whose type is a structure or union
  4822.        are required to be constructed to contain assignments of
  4823.        a temporary variable, so that we can evaluate them here
  4824.        for side effect only.  If type is void, we must do likewise.  */
  4825.  
  4826.     /* If an arm of the branch requires a cleanup,
  4827.        only that cleanup is performed.  */
  4828.  
  4829.     tree singleton = 0;
  4830.     tree binary_op = 0, unary_op = 0;
  4831.     tree old_cleanups = cleanups_this_call;
  4832.     cleanups_this_call = 0;
  4833.  
  4834.     /* If this is (A ? 1 : 0) and A is a condition, just evaluate it and
  4835.        convert it to our mode, if necessary.  */
  4836.     if (integer_onep (TREE_OPERAND (exp, 1))
  4837.         && integer_zerop (TREE_OPERAND (exp, 2))
  4838.         && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<')
  4839.       {
  4840.         op0 = expand_expr (TREE_OPERAND (exp, 0), target, mode, modifier);
  4841.         if (GET_MODE (op0) == mode)
  4842.           return op0;
  4843.         if (target == 0)
  4844.           target = gen_reg_rtx (mode);
  4845.         convert_move (target, op0, unsignedp);
  4846.         return target;
  4847.       }
  4848.  
  4849.     /* If we are not to produce a result, we have no target.  Otherwise,
  4850.        if a target was specified use it; it will not be used as an
  4851.        intermediate target unless it is safe.  If no target, use a 
  4852.        temporary.  */
  4853.  
  4854.     if (mode == VOIDmode || ignore)
  4855.       temp = 0;
  4856.     else if (original_target
  4857.          && safe_from_p (original_target, TREE_OPERAND (exp, 0)))
  4858.       temp = original_target;
  4859.     else if (mode == BLKmode)
  4860.       {
  4861.         if (TYPE_SIZE (type) == 0
  4862.         || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
  4863.           abort ();
  4864.         temp = assign_stack_temp (BLKmode,
  4865.                       (TREE_INT_CST_LOW (TYPE_SIZE (type))
  4866.                        + BITS_PER_UNIT - 1)
  4867.                       / BITS_PER_UNIT, 0);
  4868.       }
  4869.     else
  4870.       temp = gen_reg_rtx (mode);
  4871.  
  4872.     /* Check for X ? A + B : A.  If we have this, we can copy
  4873.        A to the output and conditionally add B.  Similarly for unary
  4874.        operations.  Don't do this if X has side-effects because
  4875.        those side effects might affect A or B and the "?" operation is
  4876.        a sequence point in ANSI.  (We test for side effects later.)  */
  4877.  
  4878.     if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 1))) == '2'
  4879.         && operand_equal_p (TREE_OPERAND (exp, 2),
  4880.                 TREE_OPERAND (TREE_OPERAND (exp, 1), 0), 0))
  4881.       singleton = TREE_OPERAND (exp, 2), binary_op = TREE_OPERAND (exp, 1);
  4882.     else if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 2))) == '2'
  4883.          && operand_equal_p (TREE_OPERAND (exp, 1),
  4884.                      TREE_OPERAND (TREE_OPERAND (exp, 2), 0), 0))
  4885.       singleton = TREE_OPERAND (exp, 1), binary_op = TREE_OPERAND (exp, 2);
  4886.     else if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 1))) == '1'
  4887.          && operand_equal_p (TREE_OPERAND (exp, 2),
  4888.                      TREE_OPERAND (TREE_OPERAND (exp, 1), 0), 0))
  4889.       singleton = TREE_OPERAND (exp, 2), unary_op = TREE_OPERAND (exp, 1);
  4890.     else if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 2))) == '1'
  4891.          && operand_equal_p (TREE_OPERAND (exp, 1),
  4892.                      TREE_OPERAND (TREE_OPERAND (exp, 2), 0), 0))
  4893.       singleton = TREE_OPERAND (exp, 1), unary_op = TREE_OPERAND (exp, 2);
  4894.  
  4895.     /* If we had X ? A + 1 : A and we can do the test of X as a store-flag
  4896.        operation, do this as A + (X != 0).  Similarly for other simple
  4897.        binary operators.  */
  4898.     if (singleton && binary_op
  4899.         && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0))
  4900.         && (TREE_CODE (binary_op) == PLUS_EXPR
  4901.         || TREE_CODE (binary_op) == MINUS_EXPR
  4902.         || TREE_CODE (binary_op) == BIT_IOR_EXPR
  4903.         || TREE_CODE (binary_op) == BIT_XOR_EXPR
  4904.         || TREE_CODE (binary_op) == BIT_AND_EXPR)
  4905.         && integer_onep (TREE_OPERAND (binary_op, 1))
  4906.         && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<')
  4907.       {
  4908.         rtx result;
  4909.         optab boptab = (TREE_CODE (binary_op) == PLUS_EXPR ? add_optab
  4910.                 : TREE_CODE (binary_op) == MINUS_EXPR ? sub_optab
  4911.                 : TREE_CODE (binary_op) == BIT_IOR_EXPR ? ior_optab
  4912.                 : TREE_CODE (binary_op) == BIT_XOR_EXPR ? xor_optab
  4913.                 : and_optab);
  4914.  
  4915.         /* If we had X ? A : A + 1, do this as A + (X == 0).
  4916.  
  4917.            We have to invert the truth value here and then put it
  4918.            back later if do_store_flag fails.  We cannot simply copy
  4919.            TREE_OPERAND (exp, 0) to another variable and modify that
  4920.            because invert_truthvalue can modify the tree pointed to
  4921.            by its argument.  */
  4922.         if (singleton == TREE_OPERAND (exp, 1))
  4923.           TREE_OPERAND (exp, 0)
  4924.         = invert_truthvalue (TREE_OPERAND (exp, 0));
  4925.  
  4926.         result = do_store_flag (TREE_OPERAND (exp, 0),
  4927.                     (safe_from_p (temp, singleton)
  4928.                      ? temp : NULL_RTX),
  4929.                     mode, BRANCH_COST <= 1);
  4930.  
  4931.         if (result)
  4932.           {
  4933.         op1 = expand_expr (singleton, NULL_RTX, VOIDmode, 0);
  4934.         return expand_binop (mode, boptab, op1, result, temp,
  4935.                      unsignedp, OPTAB_LIB_WIDEN);
  4936.           }
  4937.         else if (singleton == TREE_OPERAND (exp, 1))
  4938.           TREE_OPERAND (exp, 0)
  4939.         = invert_truthvalue (TREE_OPERAND (exp, 0));
  4940.       }
  4941.         
  4942.     NO_DEFER_POP;
  4943.     op0 = gen_label_rtx ();
  4944.  
  4945.     if (singleton && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0)))
  4946.       {
  4947.         if (temp != 0)
  4948.           {
  4949.         /* If the target conflicts with the other operand of the
  4950.            binary op, we can't use it.  Also, we can't use the target
  4951.            if it is a hard register, because evaluating the condition
  4952.            might clobber it.  */
  4953.         if ((binary_op
  4954.              && ! safe_from_p (temp, TREE_OPERAND (binary_op, 1)))
  4955.             || (GET_CODE (temp) == REG
  4956.             && REGNO (temp) < FIRST_PSEUDO_REGISTER))
  4957.           temp = gen_reg_rtx (mode);
  4958.         store_expr (singleton, temp, 0);
  4959.           }
  4960.         else
  4961.           expand_expr (singleton,
  4962.                ignore ? const1_rtx : NULL_RTX, VOIDmode, 0);
  4963.         if (cleanups_this_call)
  4964.           {
  4965.         sorry ("aggregate value in COND_EXPR");
  4966.         cleanups_this_call = 0;
  4967.           }
  4968.         if (singleton == TREE_OPERAND (exp, 1))
  4969.           jumpif (TREE_OPERAND (exp, 0), op0);
  4970.         else
  4971.           jumpifnot (TREE_OPERAND (exp, 0), op0);
  4972.  
  4973.         if (binary_op && temp == 0)
  4974.           /* Just touch the other operand.  */
  4975.           expand_expr (TREE_OPERAND (binary_op, 1),
  4976.                ignore ? const0_rtx : NULL_RTX, VOIDmode, 0);
  4977.         else if (binary_op)
  4978.           store_expr (build (TREE_CODE (binary_op), type,
  4979.                  make_tree (type, temp),
  4980.                  TREE_OPERAND (binary_op, 1)),
  4981.               temp, 0);
  4982.         else
  4983.           store_expr (build1 (TREE_CODE (unary_op), type,
  4984.                   make_tree (type, temp)),
  4985.               temp, 0);
  4986.         op1 = op0;
  4987.       }
  4988. #if 0
  4989.     /* This is now done in jump.c and is better done there because it
  4990.        produces shorter register lifetimes.  */
  4991.        
  4992.     /* Check for both possibilities either constants or variables
  4993.        in registers (but not the same as the target!).  If so, can
  4994.        save branches by assigning one, branching, and assigning the
  4995.        other.  */
  4996.     else if (temp && GET_MODE (temp) != BLKmode
  4997.          && (TREE_CONSTANT (TREE_OPERAND (exp, 1))
  4998.              || ((TREE_CODE (TREE_OPERAND (exp, 1)) == PARM_DECL
  4999.               || TREE_CODE (TREE_OPERAND (exp, 1)) == VAR_DECL)
  5000.              && DECL_RTL (TREE_OPERAND (exp, 1))
  5001.              && GET_CODE (DECL_RTL (TREE_OPERAND (exp, 1))) == REG
  5002.              && DECL_RTL (TREE_OPERAND (exp, 1)) != temp))
  5003.          && (TREE_CONSTANT (TREE_OPERAND (exp, 2))
  5004.              || ((TREE_CODE (TREE_OPERAND (exp, 2)) == PARM_DECL
  5005.               || TREE_CODE (TREE_OPERAND (exp, 2)) == VAR_DECL)
  5006.              && DECL_RTL (TREE_OPERAND (exp, 2))
  5007.              && GET_CODE (DECL_RTL (TREE_OPERAND (exp, 2))) == REG
  5008.              && DECL_RTL (TREE_OPERAND (exp, 2)) != temp)))
  5009.       {
  5010.         if (GET_CODE (temp) == REG && REGNO (temp) < FIRST_PSEUDO_REGISTER)
  5011.           temp = gen_reg_rtx (mode);
  5012.         store_expr (TREE_OPERAND (exp, 2), temp, 0);
  5013.         jumpifnot (TREE_OPERAND (exp, 0), op0);
  5014.         store_expr (TREE_OPERAND (exp, 1), temp, 0);
  5015.         op1 = op0;
  5016.       }
  5017. #endif
  5018.     /* Check for A op 0 ? A : FOO and A op 0 ? FOO : A where OP is any
  5019.        comparison operator.  If we have one of these cases, set the
  5020.        output to A, branch on A (cse will merge these two references),
  5021.        then set the output to FOO.  */
  5022.     else if (temp
  5023.          && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<'
  5024.          && integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 1))
  5025.          && operand_equal_p (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
  5026.                      TREE_OPERAND (exp, 1), 0)
  5027.          && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0))
  5028.          && safe_from_p (temp, TREE_OPERAND (exp, 2)))
  5029.       {
  5030.         if (GET_CODE (temp) == REG && REGNO (temp) < FIRST_PSEUDO_REGISTER)
  5031.           temp = gen_reg_rtx (mode);
  5032.         store_expr (TREE_OPERAND (exp, 1), temp, 0);
  5033.         jumpif (TREE_OPERAND (exp, 0), op0);
  5034.         store_expr (TREE_OPERAND (exp, 2), temp, 0);
  5035.         op1 = op0;
  5036.       }
  5037.     else if (temp
  5038.          && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<'
  5039.          && integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 1))
  5040.          && operand_equal_p (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
  5041.                      TREE_OPERAND (exp, 2), 0)
  5042.          && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0))
  5043.          && safe_from_p (temp, TREE_OPERAND (exp, 1)))
  5044.       {
  5045.         if (GET_CODE (temp) == REG && REGNO (temp) < FIRST_PSEUDO_REGISTER)
  5046.           temp = gen_reg_rtx (mode);
  5047.         store_expr (TREE_OPERAND (exp, 2), temp, 0);
  5048.         jumpifnot (TREE_OPERAND (exp, 0), op0);
  5049.         store_expr (TREE_OPERAND (exp, 1), temp, 0);
  5050.         op1 = op0;
  5051.       }
  5052.     else
  5053.       {
  5054.         op1 = gen_label_rtx ();
  5055.         jumpifnot (TREE_OPERAND (exp, 0), op0);
  5056.         if (temp != 0)
  5057.           store_expr (TREE_OPERAND (exp, 1), temp, 0);
  5058.         else
  5059.           expand_expr (TREE_OPERAND (exp, 1),
  5060.                ignore ? const0_rtx : NULL_RTX, VOIDmode, 0);
  5061.         if (cleanups_this_call)
  5062.           {
  5063.         sorry ("aggregate value in COND_EXPR");
  5064.         cleanups_this_call = 0;
  5065.           }
  5066.  
  5067.         emit_queue ();
  5068.         emit_jump_insn (gen_jump (op1));
  5069.         emit_barrier ();
  5070.         emit_label (op0);
  5071.         if (temp != 0)
  5072.           store_expr (TREE_OPERAND (exp, 2), temp, 0);
  5073.         else
  5074.           expand_expr (TREE_OPERAND (exp, 2),
  5075.                ignore ? const0_rtx : NULL_RTX, VOIDmode, 0);
  5076.       }
  5077.  
  5078.     if (cleanups_this_call)
  5079.       {
  5080.         sorry ("aggregate value in COND_EXPR");
  5081.         cleanups_this_call = 0;
  5082.       }
  5083.  
  5084.     emit_queue ();
  5085.     emit_label (op1);
  5086.     OK_DEFER_POP;
  5087.     cleanups_this_call = old_cleanups;
  5088.     return temp;
  5089.       }
  5090.  
  5091.     case TARGET_EXPR:
  5092.       {
  5093.     /* Something needs to be initialized, but we didn't know
  5094.        where that thing was when building the tree.  For example,
  5095.        it could be the return value of a function, or a parameter
  5096.        to a function which lays down in the stack, or a temporary
  5097.        variable which must be passed by reference.
  5098.  
  5099.        We guarantee that the expression will either be constructed
  5100.        or copied into our original target.  */
  5101.  
  5102.     tree slot = TREE_OPERAND (exp, 0);
  5103.     tree exp1;
  5104.  
  5105.     if (TREE_CODE (slot) != VAR_DECL)
  5106.       abort ();
  5107.  
  5108.     if (target == 0)
  5109.       {
  5110.         if (DECL_RTL (slot) != 0)
  5111.           {
  5112.         target = DECL_RTL (slot);
  5113.         /* If we have already expanded the slot, so don't do
  5114.            it again.  (mrs)  */
  5115.         if (TREE_OPERAND (exp, 1) == NULL_TREE)
  5116.           return target;
  5117.           }
  5118.         else
  5119.           {
  5120.         target = assign_stack_temp (mode, int_size_in_bytes (type), 0);
  5121.         /* All temp slots at this level must not conflict.  */
  5122.         preserve_temp_slots (target);
  5123.         DECL_RTL (slot) = target;
  5124.           }
  5125.  
  5126. #if 0
  5127.         /* I bet this needs to be done, and I bet that it needs to
  5128.            be above, inside the else clause.  The reason is
  5129.            simple, how else is it going to get cleaned up? (mrs)
  5130.  
  5131.            The reason is probably did not work before, and was
  5132.            commented out is because this was re-expanding already
  5133.            expanded target_exprs (target == 0 and DECL_RTL (slot)
  5134.            != 0) also cleaning them up many times as well.  :-( */
  5135.  
  5136.         /* Since SLOT is not known to the called function
  5137.            to belong to its stack frame, we must build an explicit
  5138.            cleanup.  This case occurs when we must build up a reference
  5139.            to pass the reference as an argument.  In this case,
  5140.            it is very likely that such a reference need not be
  5141.            built here.  */
  5142.  
  5143.         if (TREE_OPERAND (exp, 2) == 0)
  5144.           TREE_OPERAND (exp, 2) = maybe_build_cleanup (slot);
  5145.         if (TREE_OPERAND (exp, 2))
  5146.           cleanups_this_call = tree_cons (NULL_TREE, TREE_OPERAND (exp, 2),
  5147.                           cleanups_this_call);
  5148. #endif
  5149.       }
  5150.     else
  5151.       {
  5152.         /* This case does occur, when expanding a parameter which
  5153.            needs to be constructed on the stack.  The target
  5154.            is the actual stack address that we want to initialize.
  5155.            The function we call will perform the cleanup in this case.  */
  5156.  
  5157.         DECL_RTL (slot) = target;
  5158.       }
  5159.  
  5160.     exp1 = TREE_OPERAND (exp, 1);
  5161.     /* Mark it as expanded.  */
  5162.     TREE_OPERAND (exp, 1) = NULL_TREE;
  5163.  
  5164.     return expand_expr (exp1, target, tmode, modifier);
  5165.       }
  5166.  
  5167.     case INIT_EXPR:
  5168.       {
  5169.     tree lhs = TREE_OPERAND (exp, 0);
  5170.     tree rhs = TREE_OPERAND (exp, 1);
  5171.     tree noncopied_parts = 0;
  5172.     tree lhs_type = TREE_TYPE (lhs);
  5173.  
  5174.     temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
  5175.     if (TYPE_NONCOPIED_PARTS (lhs_type) != 0 && !fixed_type_p (rhs))
  5176.       noncopied_parts = init_noncopied_parts (stabilize_reference (lhs),
  5177.                           TYPE_NONCOPIED_PARTS (lhs_type));
  5178.     while (noncopied_parts != 0)
  5179.       {
  5180.         expand_assignment (TREE_VALUE (noncopied_parts),
  5181.                    TREE_PURPOSE (noncopied_parts), 0, 0);
  5182.         noncopied_parts = TREE_CHAIN (noncopied_parts);
  5183.       }
  5184.     return temp;
  5185.       }
  5186.  
  5187.     case MODIFY_EXPR:
  5188.       {
  5189.     /* If lhs is complex, expand calls in rhs before computing it.
  5190.        That's so we don't compute a pointer and save it over a call.
  5191.        If lhs is simple, compute it first so we can give it as a
  5192.        target if the rhs is just a call.  This avoids an extra temp and copy
  5193.        and that prevents a partial-subsumption which makes bad code.
  5194.        Actually we could treat component_ref's of vars like vars.  */
  5195.  
  5196.     tree lhs = TREE_OPERAND (exp, 0);
  5197.     tree rhs = TREE_OPERAND (exp, 1);
  5198.     tree noncopied_parts = 0;
  5199.     tree lhs_type = TREE_TYPE (lhs);
  5200.  
  5201.     temp = 0;
  5202.  
  5203.     if (TREE_CODE (lhs) != VAR_DECL
  5204.         && TREE_CODE (lhs) != RESULT_DECL
  5205.         && TREE_CODE (lhs) != PARM_DECL)
  5206.       preexpand_calls (exp);
  5207.  
  5208.     /* Check for |= or &= of a bitfield of size one into another bitfield
  5209.        of size 1.  In this case, (unless we need the result of the
  5210.        assignment) we can do this more efficiently with a
  5211.        test followed by an assignment, if necessary.
  5212.  
  5213.        ??? At this point, we can't get a BIT_FIELD_REF here.  But if
  5214.        things change so we do, this code should be enhanced to
  5215.        support it.  */
  5216.     if (ignore
  5217.         && TREE_CODE (lhs) == COMPONENT_REF
  5218.         && (TREE_CODE (rhs) == BIT_IOR_EXPR
  5219.         || TREE_CODE (rhs) == BIT_AND_EXPR)
  5220.         && TREE_OPERAND (rhs, 0) == lhs
  5221.         && TREE_CODE (TREE_OPERAND (rhs, 1)) == COMPONENT_REF
  5222.         && TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (lhs, 1))) == 1
  5223.         && TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (TREE_OPERAND (rhs, 1), 1))) == 1)
  5224.       {
  5225.         rtx label = gen_label_rtx ();
  5226.  
  5227.         do_jump (TREE_OPERAND (rhs, 1),
  5228.              TREE_CODE (rhs) == BIT_IOR_EXPR ? label : 0,
  5229.              TREE_CODE (rhs) == BIT_AND_EXPR ? label : 0);
  5230.         expand_assignment (lhs, convert (TREE_TYPE (rhs),
  5231.                          (TREE_CODE (rhs) == BIT_IOR_EXPR
  5232.                           ? integer_one_node
  5233.                           : integer_zero_node)),
  5234.                    0, 0);
  5235.         do_pending_stack_adjust ();
  5236.         emit_label (label);
  5237.         return const0_rtx;
  5238.       }
  5239.  
  5240.     if (TYPE_NONCOPIED_PARTS (lhs_type) != 0
  5241.         && ! (fixed_type_p (lhs) && fixed_type_p (rhs)))
  5242.       noncopied_parts = save_noncopied_parts (stabilize_reference (lhs),
  5243.                           TYPE_NONCOPIED_PARTS (lhs_type));
  5244.  
  5245.     temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
  5246.     while (noncopied_parts != 0)
  5247.       {
  5248.         expand_assignment (TREE_PURPOSE (noncopied_parts),
  5249.                    TREE_VALUE (noncopied_parts), 0, 0);
  5250.         noncopied_parts = TREE_CHAIN (noncopied_parts);
  5251.       }
  5252.     return temp;
  5253.       }
  5254.  
  5255.     case PREINCREMENT_EXPR:
  5256.     case PREDECREMENT_EXPR:
  5257.       return expand_increment (exp, 0);
  5258.  
  5259.     case POSTINCREMENT_EXPR:
  5260.     case POSTDECREMENT_EXPR:
  5261.       /* Faster to treat as pre-increment if result is not used.  */
  5262.       return expand_increment (exp, ! ignore);
  5263.  
  5264.     case ADDR_EXPR:
  5265.       /* Are we taking the address of a nested function?  */
  5266.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == FUNCTION_DECL
  5267.       && decl_function_context (TREE_OPERAND (exp, 0)) != 0)
  5268.     {
  5269.       op0 = trampoline_address (TREE_OPERAND (exp, 0));
  5270.       op0 = force_operand (op0, target);
  5271.     }
  5272.       else
  5273.     {
  5274.       op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode,
  5275.                  (modifier == EXPAND_INITIALIZER
  5276.                   ? modifier : EXPAND_CONST_ADDRESS));
  5277.       if (GET_CODE (op0) != MEM)
  5278.         abort ();
  5279.   
  5280.       if (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER)
  5281.         return XEXP (op0, 0);
  5282.       op0 = force_operand (XEXP (op0, 0), target);
  5283.     }
  5284.       if (flag_force_addr && GET_CODE (op0) != REG)
  5285.     return force_reg ((TREE_CODE (TREE_OPERAND (exp, 0)) == FUNCTION_DECL ? TPmode : DPmode), op0);
  5286.       return op0;
  5287.  
  5288.     case ENTRY_VALUE_EXPR:
  5289.       abort ();
  5290.  
  5291.     /* COMPLEX type for Extended Pascal & Fortran  */
  5292.     case COMPLEX_EXPR:
  5293.       {
  5294.     enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (exp)));
  5295.  
  5296.     rtx prev;
  5297.  
  5298.     /* Get the rtx code of the operands.  */
  5299.     op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  5300.     op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  5301.  
  5302.     if (! target)
  5303.       target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
  5304.  
  5305.     prev = get_last_insn ();
  5306.  
  5307.     /* Tell flow that the whole of the destination is being set.  */
  5308.     if (GET_CODE (target) == REG)
  5309.       emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  5310.  
  5311.     /* Move the real (op0) and imaginary (op1) parts to their location.  */
  5312.     emit_move_insn (gen_realpart (mode, target), op0);
  5313.     emit_move_insn (gen_imagpart (mode, target), op1);
  5314.  
  5315.     /* Complex construction should appear as a single unit.  */
  5316.     group_insns (prev);
  5317.  
  5318.     return target;
  5319.       }
  5320.  
  5321.     case REALPART_EXPR:
  5322.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  5323.       return gen_realpart (mode, op0);
  5324.       
  5325.     case IMAGPART_EXPR:
  5326.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  5327.       return gen_imagpart (mode, op0);
  5328.  
  5329.     case CONJ_EXPR:
  5330.       {
  5331.     enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (exp)));
  5332.     rtx imag_t;
  5333.     rtx prev;
  5334.     
  5335.     op0  = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  5336.  
  5337.     if (! target)
  5338.       target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
  5339.                                     
  5340.     prev = get_last_insn ();
  5341.  
  5342.     /* Tell flow that the whole of the destination is being set.  */
  5343.     if (GET_CODE (target) == REG)
  5344.       emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  5345.  
  5346.     /* Store the realpart and the negated imagpart to target.  */
  5347.     emit_move_insn (gen_realpart (mode, target), gen_realpart (mode, op0));
  5348.  
  5349.     imag_t = gen_imagpart (mode, target);
  5350.     temp   = expand_unop (mode, neg_optab,
  5351.                   gen_imagpart (mode, op0), imag_t, 0);
  5352.     if (temp != imag_t)
  5353.       emit_move_insn (imag_t, temp);
  5354.  
  5355.     /* Conjugate should appear as a single unit */
  5356.     group_insns (prev);
  5357.  
  5358.     return target;
  5359.       }
  5360.  
  5361.     case ERROR_MARK:
  5362.       return const0_rtx;
  5363.  
  5364.     default:
  5365.       return (*lang_expand_expr) (exp, target, tmode, modifier);
  5366.     }
  5367.  
  5368.   /* Here to do an ordinary binary operator, generating an instruction
  5369.      from the optab already placed in `this_optab'.  */
  5370.  binop:
  5371.   preexpand_calls (exp);
  5372.   if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  5373.     subtarget = 0;
  5374.   op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  5375.   op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  5376.  binop2:
  5377.   temp = expand_binop (mode, this_optab, op0, op1, target,
  5378.                unsignedp, OPTAB_LIB_WIDEN);
  5379.   if (temp == 0)
  5380.     abort ();
  5381.   return temp;
  5382. }
  5383.  
  5384. /* Return the alignment in bits of EXP, a pointer valued expression.
  5385.    But don't return more than MAX_ALIGN no matter what.
  5386.    The alignment returned is, by default, the alignment of the thing that
  5387.    EXP points to (if it is not a POINTER_TYPE, 0 is returned).
  5388.  
  5389.    Otherwise, look at the expression to see if we can do better, i.e., if the
  5390.    expression is actually pointing at an object whose alignment is tighter.  */
  5391.  
  5392. static int
  5393. get_pointer_alignment (exp, max_align)
  5394.      tree exp;
  5395.      unsigned max_align;
  5396. {
  5397.   unsigned align, inner;
  5398.  
  5399.   if (TREE_CODE (TREE_TYPE (exp)) != POINTER_TYPE)
  5400.     return 0;
  5401.  
  5402.   align = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)));
  5403.   align = MIN (align, max_align);
  5404.  
  5405.   while (1)
  5406.     {
  5407.       switch (TREE_CODE (exp))
  5408.     {
  5409.     case NOP_EXPR:
  5410.     case CONVERT_EXPR:
  5411.     case NON_LVALUE_EXPR:
  5412.       exp = TREE_OPERAND (exp, 0);
  5413.       if (TREE_CODE (TREE_TYPE (exp)) != POINTER_TYPE)
  5414.         return align;
  5415.       inner = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)));
  5416.       inner = MIN (inner, max_align);
  5417.       align = MAX (align, inner);
  5418.       break;
  5419.  
  5420.     case PLUS_EXPR:
  5421.       /* If sum of pointer + int, restrict our maximum alignment to that
  5422.          imposed by the integer.  If not, we can't do any better than
  5423.          ALIGN.  */
  5424.       if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST)
  5425.         return align;
  5426.  
  5427.       while (((TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)) * BITS_PER_UNIT)
  5428.           & (max_align - 1))
  5429.          != 0)
  5430.         max_align >>= 1;
  5431.  
  5432.       exp = TREE_OPERAND (exp, 0);
  5433.       break;
  5434.  
  5435.     case ADDR_EXPR:
  5436.       /* See what we are pointing at and look at its alignment.  */
  5437.       exp = TREE_OPERAND (exp, 0);
  5438.       if (TREE_CODE (exp) == FUNCTION_DECL)
  5439.         align = MAX (align, FUNCTION_BOUNDARY);
  5440.       else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd')
  5441.         align = MAX (align, DECL_ALIGN (exp));
  5442. #ifdef CONSTANT_ALIGNMENT
  5443.       else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c')
  5444.         align = CONSTANT_ALIGNMENT (exp, align);
  5445. #endif
  5446.       return MIN (align, max_align);
  5447.  
  5448.     default:
  5449.       return align;
  5450.     }
  5451.     }
  5452. }
  5453.  
  5454. /* Return the tree node and offset if a given argument corresponds to
  5455.    a string constant.  */
  5456.  
  5457. static tree
  5458. string_constant (arg, ptr_offset)
  5459.      tree arg;
  5460.      tree *ptr_offset;
  5461. {
  5462.   STRIP_NOPS (arg);
  5463.  
  5464.   if (TREE_CODE (arg) == ADDR_EXPR
  5465.       && TREE_CODE (TREE_OPERAND (arg, 0)) == STRING_CST)
  5466.     {
  5467.       *ptr_offset = integer_zero_node;
  5468.       return TREE_OPERAND (arg, 0);
  5469.     }
  5470.   else if (TREE_CODE (arg) == PLUS_EXPR)
  5471.     {
  5472.       tree arg0 = TREE_OPERAND (arg, 0);
  5473.       tree arg1 = TREE_OPERAND (arg, 1);
  5474.  
  5475.       STRIP_NOPS (arg0);
  5476.       STRIP_NOPS (arg1);
  5477.  
  5478.       if (TREE_CODE (arg0) == ADDR_EXPR
  5479.       && TREE_CODE (TREE_OPERAND (arg0, 0)) == STRING_CST)
  5480.     {
  5481.       *ptr_offset = arg1;
  5482.       return TREE_OPERAND (arg0, 0);
  5483.     }
  5484.       else if (TREE_CODE (arg1) == ADDR_EXPR
  5485.            && TREE_CODE (TREE_OPERAND (arg1, 0)) == STRING_CST)
  5486.     {
  5487.       *ptr_offset = arg0;
  5488.       return TREE_OPERAND (arg1, 0);
  5489.     }
  5490.     }
  5491.  
  5492.   return 0;
  5493. }
  5494.  
  5495. /* Compute the length of a C string.  TREE_STRING_LENGTH is not the right
  5496.    way, because it could contain a zero byte in the middle.
  5497.    TREE_STRING_LENGTH is the size of the character array, not the string.
  5498.  
  5499.    Unfortunately, string_constant can't access the values of const char
  5500.    arrays with initializers, so neither can we do so here.  */
  5501.  
  5502. static tree
  5503. c_strlen (src)
  5504.      tree src;
  5505. {
  5506.   tree offset_node;
  5507.   int offset, max;
  5508.   char *ptr;
  5509.  
  5510.   src = string_constant (src, &offset_node);
  5511.   if (src == 0)
  5512.     return 0;
  5513.   max = TREE_STRING_LENGTH (src);
  5514.   ptr = TREE_STRING_POINTER (src);
  5515.   if (offset_node && TREE_CODE (offset_node) != INTEGER_CST)
  5516.     {
  5517.       /* If the string has an internal zero byte (e.g., "foo\0bar"), we can't
  5518.      compute the offset to the following null if we don't know where to
  5519.      start searching for it.  */
  5520.       int i;
  5521.       for (i = 0; i < max; i++)
  5522.     if (ptr[i] == 0)
  5523.       return 0;
  5524.       /* We don't know the starting offset, but we do know that the string
  5525.      has no internal zero bytes.  We can assume that the offset falls
  5526.      within the bounds of the string; otherwise, the programmer deserves
  5527.      what he gets.  Subtract the offset from the length of the string,
  5528.      and return that.  */
  5529.       /* This would perhaps not be valid if we were dealing with named
  5530.          arrays in addition to literal string constants.  */
  5531.       return size_binop (MINUS_EXPR, size_int (max), offset_node);
  5532.     }
  5533.  
  5534.   /* We have a known offset into the string.  Start searching there for
  5535.      a null character.  */
  5536.   if (offset_node == 0)
  5537.     offset = 0;
  5538.   else
  5539.     {
  5540.       /* Did we get a long long offset?  If so, punt.  */
  5541.       if (TREE_INT_CST_HIGH (offset_node) != 0)
  5542.     return 0;
  5543.       offset = TREE_INT_CST_LOW (offset_node);
  5544.     }
  5545.   /* If the offset is known to be out of bounds, warn, and call strlen at
  5546.      runtime.  */
  5547.   if (offset < 0 || offset > max)
  5548.     {
  5549.       warning ("offset outside bounds of constant string");
  5550.       return 0;
  5551.     }
  5552.   /* Use strlen to search for the first zero byte.  Since any strings
  5553.      constructed with build_string will have nulls appended, we win even
  5554.      if we get handed something like (char[4])"abcd".
  5555.  
  5556.      Since OFFSET is our starting index into the string, no further
  5557.      calculation is needed.  */
  5558.   return size_int (strlen (ptr + offset));
  5559. }
  5560. #ifdef MPW
  5561. #pragma segment EXPR02
  5562. #endif /* MPW */
  5563.  
  5564. /* Expand an expression EXP that calls a built-in function,
  5565.    with result going to TARGET if that's convenient
  5566.    (and in mode MODE if that's convenient).
  5567.    SUBTARGET may be used as the target for computing one of EXP's operands.
  5568.    IGNORE is nonzero if the value is to be ignored.  */
  5569.  
  5570. static rtx
  5571. expand_builtin (exp, target, subtarget, mode, ignore)
  5572.      tree exp;
  5573.      rtx target;
  5574.      rtx subtarget;
  5575.      enum machine_mode mode;
  5576.      int ignore;
  5577. {
  5578.   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
  5579.   tree arglist = TREE_OPERAND (exp, 1);
  5580.   rtx op0;
  5581.   rtx lab1, insns;
  5582.   enum machine_mode value_mode = TYPE_MODE (TREE_TYPE (exp));
  5583.   optab builtin_optab;
  5584.  
  5585.   switch (DECL_FUNCTION_CODE (fndecl))
  5586.     {
  5587.     case BUILT_IN_ABS:
  5588.     case BUILT_IN_LABS:
  5589.     case BUILT_IN_FABS:
  5590.       /* build_function_call changes these into ABS_EXPR.  */
  5591.       abort ();
  5592.  
  5593.     case BUILT_IN_SIN:
  5594.     case BUILT_IN_COS:
  5595.     case BUILT_IN_FSQRT:
  5596. #ifdef ADDITIONAL_BUILT_IN_CASES
  5597.     /* If we have additional cases of builtin functions that we know about,
  5598.        let them through this case in the big switch stmt. */
  5599.     ADDITIONAL_BUILT_IN_CASES
  5600. #endif
  5601.       /* If not optimizing, call the library function.  */
  5602.       if (! optimize)
  5603.     break;
  5604.  
  5605.       if (arglist == 0
  5606.       /* Arg could be wrong type if user redeclared this fcn wrong.  */
  5607.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != REAL_TYPE)
  5608.     return CONST0_RTX (TYPE_MODE (TREE_TYPE (exp)));
  5609.  
  5610.       /* Stabilize and compute the argument.  */
  5611.       if (TREE_CODE (TREE_VALUE (arglist)) != VAR_DECL
  5612.       && TREE_CODE (TREE_VALUE (arglist)) != PARM_DECL)
  5613.     {
  5614.       exp = copy_node (exp);
  5615.       arglist = copy_node (arglist);
  5616.       TREE_OPERAND (exp, 1) = arglist;
  5617.       TREE_VALUE (arglist) = save_expr (TREE_VALUE (arglist));
  5618.     }
  5619.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);
  5620.  
  5621.       /* Make a suitable register to place result in.  */
  5622.       target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
  5623.  
  5624.       emit_queue ();
  5625.       start_sequence ();
  5626.  
  5627.       switch (DECL_FUNCTION_CODE (fndecl))
  5628.     {
  5629.     case BUILT_IN_SIN:
  5630.       builtin_optab = sin_optab; break;
  5631.     case BUILT_IN_COS:
  5632.       builtin_optab = cos_optab; break;
  5633.     case BUILT_IN_FSQRT:
  5634.       builtin_optab = sqrt_optab; break;
  5635. #ifdef ADDITIONAL_BUILT_IN_OPS
  5636.     /* If any additional builtin operations are defined by a particular
  5637.        target machine, get their optab in here. */
  5638.     ADDITIONAL_BUILT_IN_OPS
  5639. #endif
  5640.     default:
  5641.       abort ();
  5642.     }
  5643.  
  5644.       /* Compute into TARGET.
  5645.      Set TARGET to wherever the result comes back.  */
  5646.       target = expand_unop (TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))),
  5647.                 builtin_optab, op0, target, 0);
  5648.  
  5649.       /* If we were unable to expand via the builtin, stop the
  5650.      sequence (without outputting the insns) and break, causing
  5651.      a call the the library function.  */
  5652.       if (target == 0)
  5653.     {
  5654.       end_sequence ();
  5655.       break;
  5656.         }
  5657.  
  5658.       /* Check the results by default.  But if flag_fast_math is turned on,
  5659.      then assume sqrt will always be called with valid arguments.  */
  5660.  
  5661.       if (! flag_fast_math)
  5662.     {
  5663.       /* Don't define the builtin FP instructions
  5664.          if your machine is not IEEE.  */
  5665. #ifndef MPW
  5666.       if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT)
  5667.         abort ();
  5668. #endif
  5669.  
  5670.       lab1 = gen_label_rtx ();
  5671.  
  5672.       /* Test the result; if it is NaN, set errno=EDOM because
  5673.          the argument was not in the domain.  */
  5674.       emit_cmp_insn (target, target, EQ, 0, GET_MODE (target), 0, 0);
  5675.       emit_jump_insn (gen_beq (lab1));
  5676.  
  5677. #if TARGET_EDOM
  5678.       {
  5679. #ifdef GEN_ERRNO_RTX
  5680.         rtx errno_rtx = GEN_ERRNO_RTX;
  5681. #else
  5682.         rtx errno_rtx
  5683.           = gen_rtx (MEM, word_mode, gen_rtx (SYMBOL_REF, DPmode, "*errno"));
  5684. #endif
  5685.  
  5686.         emit_move_insn (errno_rtx, GEN_INT (TARGET_EDOM));
  5687.       }
  5688. #else
  5689.       /* We can't set errno=EDOM directly; let the library call do it.
  5690.          Pop the arguments right away in case the call gets deleted. */
  5691.       NO_DEFER_POP;
  5692.       expand_call (exp, target, 0);
  5693.       OK_DEFER_POP;
  5694. #endif
  5695.  
  5696.       emit_label (lab1);
  5697.     }
  5698.  
  5699.       /* Output the entire sequence. */
  5700.       insns = get_insns ();
  5701.       end_sequence ();
  5702.       emit_insns (insns);
  5703.  
  5704.       return target;
  5705.  
  5706.     case BUILT_IN_SAVEREGS:
  5707.       /* Don't do __builtin_saveregs more than once in a function.
  5708.      Save the result of the first call and reuse it.  */
  5709.       if (saveregs_value != 0)
  5710.     return saveregs_value;
  5711.       {
  5712.     /* When this function is called, it means that registers must be
  5713.        saved on entry to this function.  So we migrate the
  5714.        call to the first insn of this function.  */
  5715.     rtx temp;
  5716.     rtx seq;
  5717.     rtx valreg, saved_valreg;
  5718.  
  5719.     /* Now really call the function.  `expand_call' does not call
  5720.        expand_builtin, so there is no danger of infinite recursion here.  */
  5721.     start_sequence ();
  5722.  
  5723. #ifdef EXPAND_BUILTIN_SAVEREGS
  5724.     /* Do whatever the machine needs done in this case.  */
  5725.     temp = EXPAND_BUILTIN_SAVEREGS (arglist);
  5726. #else
  5727.     /* The register where the function returns its value
  5728.        is likely to have something else in it, such as an argument.
  5729.        So preserve that register around the call.  */
  5730.     if (value_mode != VOIDmode)
  5731.       {
  5732.         valreg = hard_libcall_value (value_mode);
  5733.         saved_valreg = gen_reg_rtx (value_mode);
  5734.         emit_move_insn (saved_valreg, valreg);
  5735.       }
  5736.  
  5737.     /* Generate the call, putting the value in a pseudo.  */
  5738.     temp = expand_call (exp, target, ignore);
  5739.  
  5740.     if (value_mode != VOIDmode)
  5741.       emit_move_insn (valreg, saved_valreg);
  5742. #endif
  5743.  
  5744.     seq = get_insns ();
  5745.     end_sequence ();
  5746.  
  5747.     saveregs_value = temp;
  5748.  
  5749.     /* This won't work inside a SEQUENCE--it really has to be
  5750.        at the start of the function.  */
  5751.     if (in_sequence_p ())
  5752.       {
  5753.         /* Better to do this than to crash.  */
  5754.         error ("`va_start' used within `({...})'");
  5755.         return temp;
  5756.       }
  5757.  
  5758.     /* Put the sequence after the NOTE that starts the function.  */
  5759.     emit_insns_before (seq, NEXT_INSN (get_insns ()));
  5760.     return temp;
  5761.       }
  5762.  
  5763.       /* __builtin_args_info (N) returns word N of the arg space info
  5764.      for the current function.  The number and meanings of words
  5765.      is controlled by the definition of CUMULATIVE_ARGS.  */
  5766.     case BUILT_IN_ARGS_INFO:
  5767.       {
  5768.     int nwords = sizeof (CUMULATIVE_ARGS) / sizeof (int);
  5769.     int i;
  5770.     int *word_ptr = (int *) ¤t_function_args_info;
  5771.     tree type, elts, result;
  5772.  
  5773.     if (sizeof (CUMULATIVE_ARGS) % sizeof (int) != 0)
  5774.       fatal ("CUMULATIVE_ARGS type defined badly; see %s, line %d",
  5775.          __FILE__, __LINE__);
  5776.  
  5777.     if (arglist != 0)
  5778.       {
  5779.         tree arg = TREE_VALUE (arglist);
  5780.         if (TREE_CODE (arg) != INTEGER_CST)
  5781.           error ("argument of __builtin_args_info must be constant");
  5782.         else
  5783.           {
  5784.         int wordnum = TREE_INT_CST_LOW (arg);
  5785.  
  5786.         if (wordnum < 0 || wordnum >= nwords)
  5787.           error ("argument of __builtin_args_info out of range");
  5788.         else
  5789.           return GEN_INT (word_ptr[wordnum]);
  5790.           }
  5791.       }
  5792.     else
  5793.       error ("missing argument in __builtin_args_info");
  5794.  
  5795.     return const0_rtx;
  5796.  
  5797. #if 0
  5798.     for (i = 0; i < nwords; i++)
  5799.       elts = tree_cons (NULL_TREE, build_int_2 (word_ptr[i], 0));
  5800.  
  5801.     type = build_array_type (integer_type_node,
  5802.                  build_index_type (build_int_2 (nwords, 0)));
  5803.     result = build (CONSTRUCTOR, type, NULL_TREE, nreverse (elts));
  5804.     TREE_CONSTANT (result) = 1;
  5805.     TREE_STATIC (result) = 1;
  5806.     result = build (INDIRECT_REF, build_pointer_type (type), result);
  5807.     TREE_CONSTANT (result) = 1;
  5808.     return expand_expr (result, NULL_RTX, VOIDmode, 0);
  5809. #endif
  5810.       }
  5811.  
  5812.       /* Return the address of the first anonymous stack arg.  */
  5813.     case BUILT_IN_NEXT_ARG:
  5814.       {
  5815.     tree fntype = TREE_TYPE (current_function_decl);
  5816.     if (!(TYPE_ARG_TYPES (fntype) != 0
  5817.           && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
  5818.           != void_type_node)))
  5819.       {
  5820.         error ("`va_start' used in function with fixed args");
  5821.         return const0_rtx;
  5822.       }
  5823.       }
  5824.  
  5825.       return expand_binop (DPmode, add_optab,
  5826.                current_function_internal_arg_pointer,
  5827.                current_function_arg_offset_rtx,
  5828.                NULL_RTX, 0, OPTAB_LIB_WIDEN);
  5829.  
  5830.     case BUILT_IN_CLASSIFY_TYPE:
  5831.       if (arglist != 0)
  5832.     {
  5833.       tree type = TREE_TYPE (TREE_VALUE (arglist));
  5834.       enum tree_code code = TREE_CODE (type);
  5835.       if (code == VOID_TYPE)
  5836.         return GEN_INT (void_type_class);
  5837.       if (code == INTEGER_TYPE)
  5838.         return GEN_INT (integer_type_class);
  5839.       if (code == CHAR_TYPE)
  5840.         return GEN_INT (char_type_class);
  5841.       if (code == ENUMERAL_TYPE)
  5842.         return GEN_INT (enumeral_type_class);
  5843.       if (code == BOOLEAN_TYPE)
  5844.         return GEN_INT (boolean_type_class);
  5845.       if (code == POINTER_TYPE)
  5846.         return GEN_INT (pointer_type_class);
  5847.       if (code == REFERENCE_TYPE)
  5848.         return GEN_INT (reference_type_class);
  5849.       if (code == OFFSET_TYPE)
  5850.         return GEN_INT (offset_type_class);
  5851.       if (code == REAL_TYPE)
  5852.         return GEN_INT (real_type_class);
  5853.       if (code == COMPLEX_TYPE)
  5854.         return GEN_INT (complex_type_class);
  5855.       if (code == FUNCTION_TYPE)
  5856.         return GEN_INT (function_type_class);
  5857.       if (code == METHOD_TYPE)
  5858.         return GEN_INT (method_type_class);
  5859.       if (code == RECORD_TYPE)
  5860.         return GEN_INT (record_type_class);
  5861.       if (code == UNION_TYPE)
  5862.         return GEN_INT (union_type_class);
  5863.       if (code == ARRAY_TYPE)
  5864.         return GEN_INT (array_type_class);
  5865.       if (code == STRING_TYPE)
  5866.         return GEN_INT (string_type_class);
  5867.       if (code == SET_TYPE)
  5868.         return GEN_INT (set_type_class);
  5869.       if (code == FILE_TYPE)
  5870.         return GEN_INT (file_type_class);
  5871.       if (code == LANG_TYPE)
  5872.         return GEN_INT (lang_type_class);
  5873.     }
  5874.       return GEN_INT (no_type_class);
  5875.  
  5876.     case BUILT_IN_CONSTANT_P:
  5877.       if (arglist == 0)
  5878.     return const0_rtx;
  5879.       else
  5880.     return (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (arglist))) == 'c'
  5881.         ? const1_rtx : const0_rtx);
  5882.  
  5883.     case BUILT_IN_FRAME_ADDRESS:
  5884.       /* The argument must be a nonnegative integer constant.
  5885.      It counts the number of frames to scan up the stack.
  5886.      The value is the address of that frame.  */
  5887.     case BUILT_IN_RETURN_ADDRESS:
  5888.       /* The argument must be a nonnegative integer constant.
  5889.      It counts the number of frames to scan up the stack.
  5890.      The value is the return address saved in that frame.  */
  5891.       if (arglist == 0)
  5892.     /* Warning about missing arg was already issued.  */
  5893.     return const0_rtx;
  5894.       else if (TREE_CODE (TREE_VALUE (arglist)) != INTEGER_CST)
  5895.     {
  5896.       error ("invalid arg to __builtin_return_address");
  5897.       return const0_rtx;
  5898.     }
  5899.       else if (tree_int_cst_lt (TREE_VALUE (arglist), integer_zero_node))
  5900.     {
  5901.       error ("invalid arg to __builtin_return_address");
  5902.       return const0_rtx;
  5903.     }
  5904.       else
  5905.     {
  5906.       int count = TREE_INT_CST_LOW (TREE_VALUE (arglist)); 
  5907.       rtx tem = frame_pointer_rtx;
  5908.       int i;
  5909.  
  5910.       /* Scan back COUNT frames to the specified frame.  */
  5911.       for (i = 0; i < count; i++)
  5912.         {
  5913.           /* Assume the dynamic chain pointer is in the word that
  5914.          the frame address points to, unless otherwise specified.  */
  5915. #ifdef DYNAMIC_CHAIN_ADDRESS
  5916.           tem = DYNAMIC_CHAIN_ADDRESS (tem);
  5917. #endif
  5918.           tem = memory_address (DPmode, tem);
  5919.           tem = copy_to_reg (gen_rtx (MEM, DPmode, tem));
  5920.         }
  5921.  
  5922.       /* For __builtin_frame_address, return what we've got.  */
  5923.       if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_FRAME_ADDRESS)
  5924.         return tem;
  5925.  
  5926.       /* For __builtin_return_address,
  5927.          Get the return address from that frame.  */
  5928. #ifdef RETURN_ADDR_RTX
  5929.       return RETURN_ADDR_RTX (count, tem);
  5930. #else
  5931.       tem = memory_address (DPmode,
  5932.                 plus_constant (tem, GET_MODE_SIZE (DPmode)));
  5933.       return copy_to_reg (gen_rtx (MEM, DPmode, tem));
  5934. #endif
  5935.     }
  5936.  
  5937.     case BUILT_IN_ALLOCA:
  5938.       if (arglist == 0
  5939.       /* Arg could be non-integer if user redeclared this fcn wrong.  */
  5940.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
  5941.     return const0_rtx;
  5942.       current_function_calls_alloca = 1;
  5943.       /* Compute the argument.  */
  5944.       op0 = expand_expr (TREE_VALUE (arglist), NULL_RTX, VOIDmode, 0);
  5945.  
  5946.       /* Allocate the desired space.  */
  5947.       target = allocate_dynamic_stack_space (op0, target, BITS_PER_UNIT);
  5948.  
  5949.       /* Record the new stack level for nonlocal gotos.  */
  5950.       if (nonlocal_goto_handler_slot != 0)
  5951.     emit_stack_save (SAVE_NONLOCAL, &nonlocal_goto_stack_level, NULL_RTX);
  5952.       return target;
  5953.  
  5954.     case BUILT_IN_FFS:
  5955.       /* If not optimizing, call the library function.  */
  5956.       if (!optimize)
  5957.     break;
  5958.  
  5959.       if (arglist == 0
  5960.       /* Arg could be non-integer if user redeclared this fcn wrong.  */
  5961.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
  5962.     return const0_rtx;
  5963.  
  5964.       /* Compute the argument.  */
  5965.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);
  5966.       /* Compute ffs, into TARGET if possible.
  5967.      Set TARGET to wherever the result comes back.  */
  5968.       target = expand_unop (TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))),
  5969.                 ffs_optab, op0, target, 1);
  5970.       if (target == 0)
  5971.     abort ();
  5972.       return target;
  5973.  
  5974.     case BUILT_IN_STRLEN:
  5975.       /* If not optimizing, call the library function.  */
  5976.       if (!optimize)
  5977.     break;
  5978.  
  5979.       if (arglist == 0
  5980.       /* Arg could be non-pointer if user redeclared this fcn wrong.  */
  5981.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE)
  5982.     return const0_rtx;
  5983.       else
  5984.     {
  5985.       tree src = TREE_VALUE (arglist);
  5986.       tree len = c_strlen (src);
  5987.  
  5988.       int align
  5989.         = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
  5990.  
  5991.       rtx result, src_rtx, char_rtx;
  5992.       enum machine_mode insn_mode = value_mode, char_mode;
  5993.       enum insn_code icode;
  5994.  
  5995.       /* If the length is known, just return it. */
  5996.       if (len != 0)
  5997.         return expand_expr (len, target, mode, 0);
  5998.  
  5999.       /* If SRC is not a pointer type, don't do this operation inline. */
  6000.       if (align == 0)
  6001.         break;
  6002.  
  6003.       /* Call a function if we can't compute strlen in the right mode. */
  6004.  
  6005.       while (insn_mode != VOIDmode)
  6006.         {
  6007.           icode = strlen_optab->handlers[(int) insn_mode].insn_code;
  6008.           if (icode != CODE_FOR_nothing)
  6009.         break;
  6010.  
  6011.           insn_mode = GET_MODE_WIDER_MODE (insn_mode);
  6012.         }
  6013.       if (insn_mode == VOIDmode)
  6014.         break;
  6015.  
  6016.       /* Make a place to write the result of the instruction.  */
  6017.       result = target;
  6018.       if (! (result != 0
  6019.          && GET_CODE (result) == REG
  6020.          && GET_MODE (result) == insn_mode
  6021.          && REGNO (result) >= FIRST_PSEUDO_REGISTER))
  6022.         result = gen_reg_rtx (insn_mode);
  6023.  
  6024.       /* Make sure the operands are acceptable to the predicates.  */
  6025.  
  6026.       if (! (*insn_operand_predicate[(int)icode][0]) (result, insn_mode))
  6027.         result = gen_reg_rtx (insn_mode);
  6028.  
  6029.       src_rtx = memory_address (BLKmode,
  6030.                     expand_expr (src, NULL_RTX, DPmode,
  6031.                          EXPAND_NORMAL));
  6032.       if (! (*insn_operand_predicate[(int)icode][1]) (src_rtx, DPmode))
  6033.         src_rtx = copy_to_mode_reg (DPmode, src_rtx);
  6034.  
  6035.       char_rtx = const0_rtx;
  6036.       char_mode = insn_operand_mode[(int)icode][2];
  6037.       if (! (*insn_operand_predicate[(int)icode][2]) (char_rtx, char_mode))
  6038.         char_rtx = copy_to_mode_reg (char_mode, char_rtx);
  6039.  
  6040.       emit_insn (GEN_FCN (icode) (result,
  6041.                       gen_rtx (MEM, BLKmode, src_rtx),
  6042.                       char_rtx, GEN_INT (align)));
  6043.  
  6044.       /* Return the value in the proper mode for this function.  */
  6045.       if (GET_MODE (result) == value_mode)
  6046.         return result;
  6047.       else if (target != 0)
  6048.         {
  6049.           convert_move (target, result, 0);
  6050.           return target;
  6051.         }
  6052.       else
  6053.         return convert_to_mode (value_mode, result, 0);
  6054.     }
  6055.  
  6056.     case BUILT_IN_STRCPY:
  6057.       /* If not optimizing, call the library function.  */
  6058.       if (!optimize)
  6059.     break;
  6060.  
  6061.       if (arglist == 0
  6062.       /* Arg could be non-pointer if user redeclared this fcn wrong.  */
  6063.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
  6064.       || TREE_CHAIN (arglist) == 0
  6065.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE)
  6066.     return const0_rtx;
  6067.       else
  6068.     {
  6069.       tree len = c_strlen (TREE_VALUE (TREE_CHAIN (arglist)));
  6070.  
  6071.       if (len == 0)
  6072.         break;
  6073.  
  6074.       len = size_binop (PLUS_EXPR, len, integer_one_node);
  6075.  
  6076.       chainon (arglist, build_tree_list (NULL_TREE, len));
  6077.     }
  6078.  
  6079.       /* Drops in.  */
  6080.     case BUILT_IN_MEMCPY:
  6081.       /* If not optimizing, call the library function.  */
  6082.       if (!optimize)
  6083.     break;
  6084.  
  6085.       if (arglist == 0
  6086.       /* Arg could be non-pointer if user redeclared this fcn wrong.  */
  6087.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
  6088.       || TREE_CHAIN (arglist) == 0
  6089.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE
  6090.       || TREE_CHAIN (TREE_CHAIN (arglist)) == 0
  6091.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))) != INTEGER_TYPE)
  6092.     return const0_rtx;
  6093.       else
  6094.     {
  6095.       tree dest = TREE_VALUE (arglist);
  6096.       tree src = TREE_VALUE (TREE_CHAIN (arglist));
  6097.       tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
  6098.  
  6099.       int src_align
  6100.         = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
  6101.       int dest_align
  6102.         = get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
  6103.       rtx dest_rtx;
  6104.  
  6105.       /* If either SRC or DEST is not a pointer type, don't do
  6106.          this operation in-line.  */
  6107.       if (src_align == 0 || dest_align == 0)
  6108.         {
  6109.           if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STRCPY)
  6110.         TREE_CHAIN (TREE_CHAIN (arglist)) = 0;
  6111.           break;
  6112.         }
  6113.  
  6114.       dest_rtx = expand_expr (dest, NULL_RTX, DPmode, EXPAND_NORMAL);
  6115.  
  6116.       /* Copy word part most expediently.  */
  6117.       emit_block_move (gen_rtx (MEM, BLKmode,
  6118.                     memory_address (BLKmode, dest_rtx)),
  6119.                gen_rtx (MEM, BLKmode,
  6120.                     memory_address (BLKmode,
  6121.                             expand_expr (src, NULL_RTX,
  6122.                                  DPmode,
  6123.                                  EXPAND_NORMAL))),
  6124.                expand_expr (len, NULL_RTX, VOIDmode, 0),
  6125.                MIN (src_align, dest_align));
  6126.       return dest_rtx;
  6127.     }
  6128.  
  6129. /* These comparison functions need an instruction that returns an actual
  6130.    index.  An ordinary compare that just sets the condition codes
  6131.    is not enough.  */
  6132. #ifdef HAVE_cmpstrsi
  6133.     case BUILT_IN_STRCMP:
  6134.       /* If not optimizing, call the library function.  */
  6135.       if (!optimize)
  6136.     break;
  6137.  
  6138.       if (arglist == 0
  6139.       /* Arg could be non-pointer if user redeclared this fcn wrong.  */
  6140.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
  6141.       || TREE_CHAIN (arglist) == 0
  6142.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE)
  6143.     return const0_rtx;
  6144.       else if (!HAVE_cmpstrsi)
  6145.     break;
  6146.       {
  6147.     tree arg1 = TREE_VALUE (arglist);
  6148.     tree arg2 = TREE_VALUE (TREE_CHAIN (arglist));
  6149.     tree offset;
  6150.     tree len, len2;
  6151.  
  6152.     len = c_strlen (arg1);
  6153.     if (len)
  6154.       len = size_binop (PLUS_EXPR, integer_one_node, len);
  6155.     len2 = c_strlen (arg2);
  6156.     if (len2)
  6157.       len2 = size_binop (PLUS_EXPR, integer_one_node, len2);
  6158.  
  6159.     /* If we don't have a constant length for the first, use the length
  6160.        of the second, if we know it.  We don't require a constant for
  6161.        this case; some cost analysis could be done if both are available
  6162.        but neither is constant.  For now, assume they're equally cheap.
  6163.  
  6164.        If both strings have constant lengths, use the smaller.  This
  6165.        could arise if optimization results in strcpy being called with
  6166.        two fixed strings, or if the code was machine-generated.  We should
  6167.        add some code to the `memcmp' handler below to deal with such
  6168.        situations, someday.  */
  6169.     if (!len || TREE_CODE (len) != INTEGER_CST)
  6170.       {
  6171.         if (len2)
  6172.           len = len2;
  6173.         else if (len == 0)
  6174.           break;
  6175.       }
  6176.     else if (len2 && TREE_CODE (len2) == INTEGER_CST)
  6177.       {
  6178.         if (tree_int_cst_lt (len2, len))
  6179.           len = len2;
  6180.       }
  6181.  
  6182.     chainon (arglist, build_tree_list (NULL_TREE, len));
  6183.       }
  6184.  
  6185.       /* Drops in.  */
  6186.     case BUILT_IN_MEMCMP:
  6187.       /* If not optimizing, call the library function.  */
  6188.       if (!optimize)
  6189.     break;
  6190.  
  6191.       if (arglist == 0
  6192.       /* Arg could be non-pointer if user redeclared this fcn wrong.  */
  6193.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
  6194.       || TREE_CHAIN (arglist) == 0
  6195.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE
  6196.       || TREE_CHAIN (TREE_CHAIN (arglist)) == 0
  6197.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))) != INTEGER_TYPE)
  6198.     return const0_rtx;
  6199.       else if (!HAVE_cmpstrsi)
  6200.     break;
  6201.       {
  6202.     tree arg1 = TREE_VALUE (arglist);
  6203.     tree arg2 = TREE_VALUE (TREE_CHAIN (arglist));
  6204.     tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
  6205.     rtx result;
  6206.  
  6207.     int arg1_align
  6208.       = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
  6209.     int arg2_align
  6210.       = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
  6211.     enum machine_mode insn_mode
  6212.       = insn_operand_mode[(int) CODE_FOR_cmpstrsi][0];
  6213.  
  6214.     /* If we don't have POINTER_TYPE, call the function.  */
  6215.     if (arg1_align == 0 || arg2_align == 0)
  6216.       {
  6217.         if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STRCMP)
  6218.           TREE_CHAIN (TREE_CHAIN (arglist)) = 0;
  6219.         break;
  6220.       }
  6221.  
  6222.     /* Make a place to write the result of the instruction.  */
  6223.     result = target;
  6224.     if (! (result != 0
  6225.            && GET_CODE (result) == REG && GET_MODE (result) == insn_mode
  6226.            && REGNO (result) >= FIRST_PSEUDO_REGISTER))
  6227.       result = gen_reg_rtx (insn_mode);
  6228.  
  6229.     emit_insn (gen_cmpstrsi (result,
  6230.                  gen_rtx (MEM, BLKmode,
  6231.                       expand_expr (arg1, NULL_RTX, DPmode,
  6232.                                EXPAND_NORMAL)),
  6233.                  gen_rtx (MEM, BLKmode,
  6234.                       expand_expr (arg2, NULL_RTX, DPmode,
  6235.                                EXPAND_NORMAL)),
  6236.                  expand_expr (len, NULL_RTX, VOIDmode, 0),
  6237.                  GEN_INT (MIN (arg1_align, arg2_align))));
  6238.  
  6239.     /* Return the value in the proper mode for this function.  */
  6240.     mode = TYPE_MODE (TREE_TYPE (exp));
  6241.     if (GET_MODE (result) == mode)
  6242.       return result;
  6243.     else if (target != 0)
  6244.       {
  6245.         convert_move (target, result, 0);
  6246.         return target;
  6247.       }
  6248.     else
  6249.       return convert_to_mode (mode, result, 0);
  6250.       }    
  6251. #else
  6252.     case BUILT_IN_STRCMP:
  6253.     case BUILT_IN_MEMCMP:
  6254.       break;
  6255. #endif
  6256.  
  6257.     default:            /* just do library call, if unknown builtin */
  6258.       error ("built-in function %s not currently supported",
  6259.          IDENTIFIER_POINTER (DECL_NAME (fndecl)));
  6260.     }
  6261.  
  6262.   /* The switch statement above can drop through to cause the function
  6263.      to be called normally.  */
  6264.  
  6265.   return expand_call (exp, target, ignore);
  6266. }
  6267.  
  6268. /* Expand code for a post- or pre- increment or decrement
  6269.    and return the RTX for the result.
  6270.    POST is 1 for postinc/decrements and 0 for preinc/decrements.  */
  6271.  
  6272. static rtx
  6273. expand_increment (exp, post)
  6274.      register tree exp;
  6275.      int post;
  6276. {
  6277.   register rtx op0, op1;
  6278.   register rtx temp, value;
  6279.   register tree incremented = TREE_OPERAND (exp, 0);
  6280.   optab this_optab = add_optab;
  6281.   int icode;
  6282.   enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
  6283.   int op0_is_copy = 0;
  6284.  
  6285.   /* Stabilize any component ref that might need to be
  6286.      evaluated more than once below.  */
  6287.   if (TREE_CODE (incremented) == BIT_FIELD_REF
  6288.       || (TREE_CODE (incremented) == COMPONENT_REF
  6289.       && (TREE_CODE (TREE_OPERAND (incremented, 0)) != INDIRECT_REF
  6290.           || DECL_BIT_FIELD (TREE_OPERAND (incremented, 1)))))
  6291.     incremented = stabilize_reference (incremented);
  6292.  
  6293.   /* Compute the operands as RTX.
  6294.      Note whether OP0 is the actual lvalue or a copy of it:
  6295.      I believe it is a copy iff it is a register or subreg
  6296.      and insns were generated in computing it.   */
  6297.  
  6298.   temp = get_last_insn ();
  6299.   op0 = expand_expr (incremented, NULL_RTX, VOIDmode, 0);
  6300.  
  6301.   /* If OP0 is a SUBREG made for a promoted variable, we cannot increment
  6302.      in place but intead must do sign- or zero-extension during assignment,
  6303.      so we copy it into a new register and let the code below use it as
  6304.      a copy.
  6305.  
  6306.      Note that we can safely modify this SUBREG since it is know not to be
  6307.      shared (it was made by the expand_expr call above).  */
  6308.  
  6309.   if (GET_CODE (op0) == SUBREG && SUBREG_PROMOTED_VAR_P (op0))
  6310.     SUBREG_REG (op0) = copy_to_reg (SUBREG_REG (op0));
  6311.  
  6312.   op0_is_copy = ((GET_CODE (op0) == SUBREG || GET_CODE (op0) == REG)
  6313.          && temp != get_last_insn ());
  6314.   op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  6315.  
  6316.   /* Decide whether incrementing or decrementing.  */
  6317.   if (TREE_CODE (exp) == POSTDECREMENT_EXPR
  6318.       || TREE_CODE (exp) == PREDECREMENT_EXPR)
  6319.     this_optab = sub_optab;
  6320.  
  6321.   /* If OP0 is not the actual lvalue, but rather a copy in a register,
  6322.      then we cannot just increment OP0.  We must
  6323.      therefore contrive to increment the original value.
  6324.      Then we can return OP0 since it is a copy of the old value.  */
  6325.   if (op0_is_copy)
  6326.     {
  6327.       /* This is the easiest way to increment the value wherever it is.
  6328.      Problems with multiple evaluation of INCREMENTED
  6329.      are prevented because either (1) it is a component_ref,
  6330.      in which case it was stabilized above, or (2) it is an array_ref
  6331.      with constant index in an array in a register, which is
  6332.      safe to reevaluate.  */
  6333.       tree newexp = build ((this_optab == add_optab
  6334.                 ? PLUS_EXPR : MINUS_EXPR),
  6335.                TREE_TYPE (exp),
  6336.                incremented,
  6337.                TREE_OPERAND (exp, 1));
  6338.       temp = expand_assignment (incremented, newexp, ! post, 0);
  6339.       return post ? op0 : temp;
  6340.     }
  6341.  
  6342.   /* Convert decrement by a constant into a negative increment.  */
  6343.   if (this_optab == sub_optab
  6344.       && GET_CODE (op1) == CONST_INT)
  6345.     {
  6346.       op1 = GEN_INT (- INTVAL (op1));
  6347.       this_optab = add_optab;
  6348.     }
  6349.  
  6350.   if (post)
  6351.     {
  6352.       /* We have a true reference to the value in OP0.
  6353.      If there is an insn to add or subtract in this mode, queue it.  */
  6354.  
  6355. #if 0  /* Turned off to avoid making extra insn for indexed memref.  */
  6356.       op0 = stabilize (op0);
  6357. #endif
  6358.  
  6359.       icode = (int) this_optab->handlers[(int) mode].insn_code;
  6360.       if (icode != (int) CODE_FOR_nothing
  6361.       /* Make sure that OP0 is valid for operands 0 and 1
  6362.          of the insn we want to queue.  */
  6363.       && (*insn_operand_predicate[icode][0]) (op0, mode)
  6364.       && (*insn_operand_predicate[icode][1]) (op0, mode))
  6365.     {
  6366.       if (! (*insn_operand_predicate[icode][2]) (op1, mode))
  6367.         op1 = force_reg (mode, op1);
  6368.  
  6369.       return enqueue_insn (op0, GEN_FCN (icode) (op0, op0, op1));
  6370.     }
  6371.     }
  6372.  
  6373.   /* Preincrement, or we can't increment with one simple insn.  */
  6374.   if (post)
  6375.     /* Save a copy of the value before inc or dec, to return it later.  */
  6376.     temp = value = copy_to_reg (op0);
  6377.   else
  6378.     /* Arrange to return the incremented value.  */
  6379.     /* Copy the rtx because expand_binop will protect from the queue,
  6380.        and the results of that would be invalid for us to return
  6381.        if our caller does emit_queue before using our result.  */
  6382.     temp = copy_rtx (value = op0);
  6383.  
  6384.   /* Increment however we can.  */
  6385.   op1 = expand_binop (mode, this_optab, value, op1, op0,
  6386.               TREE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
  6387.   /* Make sure the value is stored into OP0.  */
  6388.   if (op1 != op0)
  6389.     emit_move_insn (op0, op1);
  6390.  
  6391.   return temp;
  6392. }
  6393.  
  6394. /* Expand all function calls contained within EXP, innermost ones first.
  6395.    But don't look within expressions that have sequence points.
  6396.    For each CALL_EXPR, record the rtx for its value
  6397.    in the CALL_EXPR_RTL field.  */
  6398.  
  6399. static void
  6400. preexpand_calls (exp)
  6401.      tree exp;
  6402. {
  6403.   register int nops, i;
  6404.   int type = TREE_CODE_CLASS (TREE_CODE (exp));
  6405.  
  6406.   if (! do_preexpand_calls)
  6407.     return;
  6408.  
  6409.   /* Only expressions and references can contain calls.  */
  6410.  
  6411.   if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r')
  6412.     return;
  6413.  
  6414.   switch (TREE_CODE (exp))
  6415.     {
  6416.     case CALL_EXPR:
  6417.       /* Do nothing if already expanded.  */
  6418.       if (CALL_EXPR_RTL (exp) != 0)
  6419.     return;
  6420.  
  6421.       /* Do nothing to built-in functions.  */
  6422.       if (TREE_CODE (TREE_OPERAND (exp, 0)) != ADDR_EXPR
  6423.       || TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) != FUNCTION_DECL
  6424.       || ! DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  6425.     CALL_EXPR_RTL (exp) = expand_call (exp, NULL_RTX, 0);
  6426.       return;
  6427.  
  6428.     case COMPOUND_EXPR:
  6429.     case COND_EXPR:
  6430.     case TRUTH_ANDIF_EXPR:
  6431.     case TRUTH_ORIF_EXPR:
  6432.       /* If we find one of these, then we can be sure
  6433.      the adjust will be done for it (since it makes jumps).
  6434.      Do it now, so that if this is inside an argument
  6435.      of a function, we don't get the stack adjustment
  6436.      after some other args have already been pushed.  */
  6437.       do_pending_stack_adjust ();
  6438.       return;
  6439.  
  6440.     case BLOCK:
  6441.     case RTL_EXPR:
  6442.     case WITH_CLEANUP_EXPR:
  6443.       return;
  6444.  
  6445.     case SAVE_EXPR:
  6446.       if (SAVE_EXPR_RTL (exp) != 0)
  6447.     return;
  6448.     }
  6449.  
  6450.   nops = tree_code_length[(int) TREE_CODE (exp)];
  6451.   for (i = 0; i < nops; i++)
  6452.     if (TREE_OPERAND (exp, i) != 0)
  6453.       {
  6454.     type = TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, i)));
  6455.     if (type == 'e' || type == '<' || type == '1' || type == '2'
  6456.         || type == 'r')
  6457.       preexpand_calls (TREE_OPERAND (exp, i));
  6458.       }
  6459. }
  6460.  
  6461. /* At the start of a function, record that we have no previously-pushed
  6462.    arguments waiting to be popped.  */
  6463.  
  6464. void
  6465. init_pending_stack_adjust ()
  6466. {
  6467.   pending_stack_adjust = 0;
  6468. #ifdef APPLE_HAX
  6469.   /* what is this for? */
  6470.   max_stack_used = 0;
  6471. #endif /* APPLE_HAX */
  6472. }
  6473.  
  6474. /* When exiting from function, if safe, clear out any pending stack adjust
  6475.    so the adjustment won't get done.  */
  6476.  
  6477. void
  6478. clear_pending_stack_adjust ()
  6479. {
  6480. #ifdef EXIT_IGNORE_STACK
  6481.   if (! flag_omit_frame_pointer && EXIT_IGNORE_STACK
  6482.       && ! (DECL_INLINE (current_function_decl) && ! flag_no_inline)
  6483.       && ! flag_inline_functions)
  6484.     pending_stack_adjust = 0;
  6485. #endif
  6486. }
  6487.  
  6488. /* Pop any previously-pushed arguments that have not been popped yet.  */
  6489.  
  6490. void
  6491. do_pending_stack_adjust ()
  6492. {
  6493.   if (inhibit_defer_pop == 0)
  6494.     {
  6495.       if (pending_stack_adjust != 0)
  6496.     adjust_stack (GEN_INT (pending_stack_adjust));
  6497.       pending_stack_adjust = 0;
  6498.     }
  6499. }
  6500.  
  6501. /* Expand all cleanups up to OLD_CLEANUPS.
  6502.    Needed here, and also for language-dependent calls.  */
  6503.  
  6504. void
  6505. expand_cleanups_to (old_cleanups)
  6506.      tree old_cleanups;
  6507. {
  6508.   while (cleanups_this_call != old_cleanups)
  6509.     {
  6510.       expand_expr (TREE_VALUE (cleanups_this_call), NULL_RTX, VOIDmode, 0);
  6511.       cleanups_this_call = TREE_CHAIN (cleanups_this_call);
  6512.     }
  6513. }
  6514.  
  6515. /* Expand conditional expressions.  */
  6516.  
  6517. /* Generate code to evaluate EXP and jump to LABEL if the value is zero.
  6518.    LABEL is an rtx of code CODE_LABEL, in this function and all the
  6519.    functions here.  */
  6520.  
  6521. void
  6522. jumpifnot (exp, label)
  6523.      tree exp;
  6524.      rtx label;
  6525. {
  6526.   do_jump (exp, label, NULL_RTX);
  6527. }
  6528.  
  6529. /* Generate code to evaluate EXP and jump to LABEL if the value is nonzero.  */
  6530.  
  6531. void
  6532. jumpif (exp, label)
  6533.      tree exp;
  6534.      rtx label;
  6535. {
  6536.   do_jump (exp, NULL_RTX, label);
  6537. }
  6538.  
  6539. /* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if
  6540.    the result is zero, or IF_TRUE_LABEL if the result is one.
  6541.    Either of IF_FALSE_LABEL and IF_TRUE_LABEL may be zero,
  6542.    meaning fall through in that case.
  6543.  
  6544.    do_jump always does any pending stack adjust except when it does not
  6545.    actually perform a jump.  An example where there is no jump
  6546.    is when EXP is `(foo (), 0)' and IF_FALSE_LABEL is null.
  6547.  
  6548.    This function is responsible for optimizing cases such as
  6549.    &&, || and comparison operators in EXP.  */
  6550.  
  6551. void
  6552. do_jump (exp, if_false_label, if_true_label)
  6553.      tree exp;
  6554.      rtx if_false_label, if_true_label;
  6555. {
  6556.   register enum tree_code code = TREE_CODE (exp);
  6557.   /* Some cases need to create a label to jump to
  6558.      in order to properly fall through.
  6559.      These cases set DROP_THROUGH_LABEL nonzero.  */
  6560.   rtx drop_through_label = 0;
  6561.   rtx temp;
  6562.   rtx comparison = 0;
  6563.   int i;
  6564.   tree type;
  6565.  
  6566.   emit_queue ();
  6567.  
  6568.   switch (code)
  6569.     {
  6570.     case ERROR_MARK:
  6571.       break;
  6572.  
  6573.     case INTEGER_CST:
  6574.       temp = integer_zerop (exp) ? if_false_label : if_true_label;
  6575.       if (temp)
  6576.     emit_jump (temp);
  6577.       break;
  6578.  
  6579. #if 0
  6580.       /* This is not true with #pragma weak  */
  6581.     case ADDR_EXPR:
  6582.       /* The address of something can never be zero.  */
  6583.       if (if_true_label)
  6584.     emit_jump (if_true_label);
  6585.       break;
  6586. #endif
  6587.  
  6588.     case NOP_EXPR:
  6589.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == COMPONENT_REF
  6590.       || TREE_CODE (TREE_OPERAND (exp, 0)) == BIT_FIELD_REF
  6591.       || TREE_CODE (TREE_OPERAND (exp, 0)) == ARRAY_REF)
  6592.     goto normal;
  6593.     case CONVERT_EXPR:
  6594.       /* If we are narrowing the operand, we have to do the compare in the
  6595.      narrower mode.  */
  6596.       if ((TYPE_PRECISION (TREE_TYPE (exp))
  6597.        < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6598.     goto normal;
  6599.     case NON_LVALUE_EXPR:
  6600.     case REFERENCE_EXPR:
  6601.     case ABS_EXPR:
  6602.     case NEGATE_EXPR:
  6603.     case LROTATE_EXPR:
  6604.     case RROTATE_EXPR:
  6605.       /* These cannot change zero->non-zero or vice versa.  */
  6606.       do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
  6607.       break;
  6608.  
  6609. #if 0
  6610.       /* This is never less insns than evaluating the PLUS_EXPR followed by
  6611.      a test and can be longer if the test is eliminated.  */
  6612.     case PLUS_EXPR:
  6613.       /* Reduce to minus.  */
  6614.       exp = build (MINUS_EXPR, TREE_TYPE (exp),
  6615.            TREE_OPERAND (exp, 0),
  6616.            fold (build1 (NEGATE_EXPR, TREE_TYPE (TREE_OPERAND (exp, 1)),
  6617.                  TREE_OPERAND (exp, 1))));
  6618.       /* Process as MINUS.  */
  6619. #endif
  6620.  
  6621.     case MINUS_EXPR:
  6622.       /* Non-zero iff operands of minus differ.  */
  6623.       comparison = compare (build (NE_EXPR, TREE_TYPE (exp),
  6624.                    TREE_OPERAND (exp, 0),
  6625.                    TREE_OPERAND (exp, 1)),
  6626.                 NE, NE);
  6627.       break;
  6628.  
  6629.     case BIT_AND_EXPR:
  6630.       /* If we are AND'ing with a small constant, do this comparison in the
  6631.      smallest type that fits.  If the machine doesn't have comparisons
  6632.      that small, it will be converted back to the wider comparison.
  6633.      This helps if we are testing the sign bit of a narrower object.
  6634.      combine can't do this for us because it can't know whether a
  6635.      ZERO_EXTRACT or a compare in a smaller mode exists, but we do.  */
  6636.  
  6637.       if (! SLOW_BYTE_ACCESS
  6638.       && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  6639.       && TYPE_PRECISION (TREE_TYPE (exp)) <= HOST_BITS_PER_WIDE_INT
  6640.       && (i = floor_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)))) >= 0
  6641.       && (type = type_for_size (i + 1, 1)) != 0
  6642.       && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
  6643.       && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
  6644.           != CODE_FOR_nothing))
  6645.     {
  6646.       do_jump (convert (type, exp), if_false_label, if_true_label);
  6647.       break;
  6648.     }
  6649.       goto normal;
  6650.  
  6651.     case TRUTH_NOT_EXPR:
  6652.       do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
  6653.       break;
  6654.  
  6655.     case TRUTH_ANDIF_EXPR:
  6656.       if (if_false_label == 0)
  6657.     if_false_label = drop_through_label = gen_label_rtx ();
  6658.       do_jump (TREE_OPERAND (exp, 0), if_false_label, NULL_RTX);
  6659.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  6660.       break;
  6661.  
  6662.     case TRUTH_ORIF_EXPR:
  6663.       if (if_true_label == 0)
  6664.     if_true_label = drop_through_label = gen_label_rtx ();
  6665.       do_jump (TREE_OPERAND (exp, 0), NULL_RTX, if_true_label);
  6666.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  6667.       break;
  6668.  
  6669.     case COMPOUND_EXPR:
  6670.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
  6671.       free_temp_slots ();
  6672.       emit_queue ();
  6673.       do_pending_stack_adjust ();
  6674.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  6675.       break;
  6676.  
  6677.     case COMPONENT_REF:
  6678.     case BIT_FIELD_REF:
  6679.     case ARRAY_REF:
  6680.       {
  6681.     int bitsize, bitpos, unsignedp;
  6682.     enum machine_mode mode;
  6683.     tree type;
  6684.     tree offset;
  6685.     int volatilep = 0;
  6686.  
  6687.     /* Get description of this reference.  We don't actually care
  6688.        about the underlying object here.  */
  6689.     get_inner_reference (exp, &bitsize, &bitpos, &offset,
  6690.                  &mode, &unsignedp, &volatilep);
  6691.  
  6692.     type = type_for_size (bitsize, unsignedp);
  6693.     if (! SLOW_BYTE_ACCESS
  6694.         && type != 0 && bitsize >= 0
  6695.         && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
  6696.         && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
  6697.         != CODE_FOR_nothing))
  6698.       {
  6699.         do_jump (convert (type, exp), if_false_label, if_true_label);
  6700.         break;
  6701.       }
  6702.     goto normal;
  6703.       }
  6704.  
  6705.     case COND_EXPR:
  6706.       /* Do (a ? 1 : 0) and (a ? 0 : 1) as special cases.  */
  6707.       if (integer_onep (TREE_OPERAND (exp, 1))
  6708.       && integer_zerop (TREE_OPERAND (exp, 2)))
  6709.     do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
  6710.  
  6711.       else if (integer_zerop (TREE_OPERAND (exp, 1))
  6712.            && integer_onep (TREE_OPERAND (exp, 2)))
  6713.     do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
  6714.  
  6715.       else
  6716.     {
  6717.       register rtx label1 = gen_label_rtx ();
  6718.       drop_through_label = gen_label_rtx ();
  6719.       do_jump (TREE_OPERAND (exp, 0), label1, NULL_RTX);
  6720.       /* Now the THEN-expression.  */
  6721.       do_jump (TREE_OPERAND (exp, 1),
  6722.            if_false_label ? if_false_label : drop_through_label,
  6723.            if_true_label ? if_true_label : drop_through_label);
  6724.       /* In case the do_jump just above never jumps.  */
  6725.       do_pending_stack_adjust ();
  6726.       emit_label (label1);
  6727.       /* Now the ELSE-expression.  */
  6728.       do_jump (TREE_OPERAND (exp, 2),
  6729.            if_false_label ? if_false_label : drop_through_label,
  6730.            if_true_label ? if_true_label : drop_through_label);
  6731.     }
  6732.       break;
  6733.  
  6734.     case EQ_EXPR:
  6735.       if (integer_zerop (TREE_OPERAND (exp, 1)))
  6736.     do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
  6737.       else if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6738.         == MODE_INT)
  6739.            && 
  6740.            !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6741.     do_jump_by_parts_equality (exp, if_false_label, if_true_label);
  6742.       else
  6743.     comparison = compare (exp, EQ, EQ);
  6744.       break;
  6745.  
  6746.     case NE_EXPR:
  6747.       if (integer_zerop (TREE_OPERAND (exp, 1)))
  6748.     do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
  6749.       else if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6750.         == MODE_INT)
  6751.            && 
  6752.            !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6753.     do_jump_by_parts_equality (exp, if_true_label, if_false_label);
  6754.       else
  6755.     comparison = compare (exp, NE, NE);
  6756.       break;
  6757.  
  6758.     case LT_EXPR:
  6759.       if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6760.        == MODE_INT)
  6761.       && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6762.     do_jump_by_parts_greater (exp, 1, if_false_label, if_true_label);
  6763.       else
  6764.     comparison = compare (exp, LT, LTU);
  6765.       break;
  6766.  
  6767.     case LE_EXPR:
  6768.       if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6769.        == MODE_INT)
  6770.       && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6771.     do_jump_by_parts_greater (exp, 0, if_true_label, if_false_label);
  6772.       else
  6773.     comparison = compare (exp, LE, LEU);
  6774.       break;
  6775.  
  6776.     case GT_EXPR:
  6777.       if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6778.        == MODE_INT)
  6779.       && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6780.     do_jump_by_parts_greater (exp, 0, if_false_label, if_true_label);
  6781.       else
  6782.     comparison = compare (exp, GT, GTU);
  6783.       break;
  6784.  
  6785.     case GE_EXPR:
  6786.       if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6787.        == MODE_INT)
  6788.       && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6789.     do_jump_by_parts_greater (exp, 1, if_true_label, if_false_label);
  6790.       else
  6791.     comparison = compare (exp, GE, GEU);
  6792.       break;
  6793.  
  6794.     default:
  6795.     normal:
  6796.       temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);
  6797. #if 0
  6798.       /* This is not needed any more and causes poor code since it causes
  6799.      comparisons and tests from non-SI objects to have different code
  6800.      sequences.  */
  6801.       /* Copy to register to avoid generating bad insns by cse
  6802.      from (set (mem ...) (arithop))  (set (cc0) (mem ...)).  */
  6803.       if (!cse_not_expected && GET_CODE (temp) == MEM)
  6804.     temp = copy_to_reg (temp);
  6805. #endif
  6806.       do_pending_stack_adjust ();
  6807.       if (GET_CODE (temp) == CONST_INT)
  6808.     comparison = (temp == const0_rtx ? const0_rtx : const_true_rtx);
  6809.       else if (GET_CODE (temp) == LABEL_REF)
  6810.     comparison = const_true_rtx;
  6811.       else if (GET_MODE_CLASS (GET_MODE (temp)) == MODE_INT
  6812.            && !can_compare_p (GET_MODE (temp)))
  6813.     /* Note swapping the labels gives us not-equal.  */
  6814.     do_jump_by_parts_equality_rtx (temp, if_true_label, if_false_label);
  6815.       else if (GET_MODE (temp) != VOIDmode)
  6816.     comparison = compare_from_rtx (temp, CONST0_RTX (GET_MODE (temp)),
  6817.                        NE, TREE_UNSIGNED (TREE_TYPE (exp)),
  6818.                        GET_MODE (temp), NULL_RTX, 0);
  6819.       else
  6820.     abort ();
  6821.     }
  6822.  
  6823.   /* Do any postincrements in the expression that was tested.  */
  6824.   emit_queue ();
  6825.  
  6826.   /* If COMPARISON is nonzero here, it is an rtx that can be substituted
  6827.      straight into a conditional jump instruction as the jump condition.
  6828.      Otherwise, all the work has been done already.  */
  6829.  
  6830.   if (comparison == const_true_rtx)
  6831.     {
  6832.       if (if_true_label)
  6833.     emit_jump (if_true_label);
  6834.     }
  6835.   else if (comparison == const0_rtx)
  6836.     {
  6837.       if (if_false_label)
  6838.     emit_jump (if_false_label);
  6839.     }
  6840.   else if (comparison)
  6841.     do_jump_for_compare (comparison, if_false_label, if_true_label);
  6842.  
  6843.   free_temp_slots ();
  6844.  
  6845.   if (drop_through_label)
  6846.     {
  6847.       /* If do_jump produces code that might be jumped around,
  6848.      do any stack adjusts from that code, before the place
  6849.      where control merges in.  */
  6850.       do_pending_stack_adjust ();
  6851.       emit_label (drop_through_label);
  6852.     }
  6853. }
  6854.  
  6855. /* Given a comparison expression EXP for values too wide to be compared
  6856.    with one insn, test the comparison and jump to the appropriate label.
  6857.    The code of EXP is ignored; we always test GT if SWAP is 0,
  6858.    and LT if SWAP is 1.  */
  6859.  
  6860. /* The following routine references a variable `comp', which is renamed
  6861.    to `compar' so it doesn't conflict with the Apple C typename. */
  6862.  
  6863. static void
  6864. do_jump_by_parts_greater (exp, swap, if_false_label, if_true_label)
  6865.      tree exp;
  6866.      int swap;
  6867.      rtx if_false_label, if_true_label;
  6868. {
  6869.   rtx op0 = expand_expr (TREE_OPERAND (exp, swap), NULL_RTX, VOIDmode, 0);
  6870.   rtx op1 = expand_expr (TREE_OPERAND (exp, !swap), NULL_RTX, VOIDmode, 0);
  6871.   enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
  6872.   int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD);
  6873.   rtx drop_through_label = 0;
  6874.   int unsignedp = TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)));
  6875.   int i;
  6876.  
  6877.   if (! if_true_label || ! if_false_label)
  6878.     drop_through_label = gen_label_rtx ();
  6879.   if (! if_true_label)
  6880.     if_true_label = drop_through_label;
  6881.   if (! if_false_label)
  6882.     if_false_label = drop_through_label;
  6883.  
  6884.   /* Compare a word at a time, high order first.  */
  6885.   for (i = 0; i < nwords; i++)
  6886.     {
  6887.       rtx compar;
  6888.       rtx op0_word, op1_word;
  6889.  
  6890.       if (WORDS_BIG_ENDIAN)
  6891.     {
  6892.       op0_word = operand_subword_force (op0, i, mode);
  6893.       op1_word = operand_subword_force (op1, i, mode);
  6894.     }
  6895.       else
  6896.     {
  6897.       op0_word = operand_subword_force (op0, nwords - 1 - i, mode);
  6898.       op1_word = operand_subword_force (op1, nwords - 1 - i, mode);
  6899.     }
  6900.  
  6901.       /* All but high-order word must be compared as unsigned.  */
  6902.       compar = compare_from_rtx (op0_word, op1_word,
  6903.                    (unsignedp || i > 0) ? GTU : GT,
  6904.                    unsignedp, word_mode, NULL_RTX, 0);
  6905.       if (compar == const_true_rtx)
  6906.     emit_jump (if_true_label);
  6907.       else if (compar != const0_rtx)
  6908.     do_jump_for_compare (compar, NULL_RTX, if_true_label);
  6909.  
  6910.       /* Consider lower words only if these are equal.  */
  6911.       compar = compare_from_rtx (op0_word, op1_word, NE, unsignedp, word_mode,
  6912.                    NULL_RTX, 0);
  6913.       if (compar == const_true_rtx)
  6914.     emit_jump (if_false_label);
  6915.       else if (compar != const0_rtx)
  6916.     do_jump_for_compare (compar, NULL_RTX, if_false_label);
  6917.     }
  6918.  
  6919.   if (if_false_label)
  6920.     emit_jump (if_false_label);
  6921.   if (drop_through_label)
  6922.     emit_label (drop_through_label);
  6923. }
  6924.  
  6925. /* Given an EQ_EXPR expression EXP for values too wide to be compared
  6926.    with one insn, test the comparison and jump to the appropriate label.  */
  6927.  
  6928. static void
  6929. do_jump_by_parts_equality (exp, if_false_label, if_true_label)
  6930.      tree exp;
  6931.      rtx if_false_label, if_true_label;
  6932. {
  6933.   rtx op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
  6934.   rtx op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  6935.   enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
  6936.   int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD);
  6937.   int i;
  6938.   rtx drop_through_label = 0;
  6939.  
  6940.   if (! if_false_label)
  6941.     drop_through_label = if_false_label = gen_label_rtx ();
  6942.  
  6943.   for (i = 0; i < nwords; i++)
  6944.     {
  6945.       rtx compar = compare_from_rtx (operand_subword_force (op0, i, mode),
  6946.                    operand_subword_force (op1, i, mode),
  6947.                    EQ, TREE_UNSIGNED (TREE_TYPE (exp)),
  6948.                    word_mode, NULL_RTX, 0);
  6949.       if (compar == const_true_rtx)
  6950.     emit_jump (if_false_label);
  6951.       else if (compar != const0_rtx)
  6952.     do_jump_for_compare (compar, if_false_label, NULL_RTX);
  6953.     }
  6954.  
  6955.   if (if_true_label)
  6956.     emit_jump (if_true_label);
  6957.   if (drop_through_label)
  6958.     emit_label (drop_through_label);
  6959. }
  6960.  
  6961. /* Jump according to whether OP0 is 0.
  6962.    We assume that OP0 has an integer mode that is too wide
  6963.    for the available compare insns.  */
  6964.  
  6965. static void
  6966. do_jump_by_parts_equality_rtx (op0, if_false_label, if_true_label)
  6967.      rtx op0;
  6968.      rtx if_false_label, if_true_label;
  6969. {
  6970.   int nwords = GET_MODE_SIZE (GET_MODE (op0)) / UNITS_PER_WORD;
  6971.   int i;
  6972.   rtx drop_through_label = 0;
  6973.  
  6974.   if (! if_false_label)
  6975.     drop_through_label = if_false_label = gen_label_rtx ();
  6976.  
  6977.   for (i = 0; i < nwords; i++)
  6978.     {
  6979.       rtx compar = compare_from_rtx (operand_subword_force (op0, i,
  6980.                               GET_MODE (op0)),
  6981.                    const0_rtx, EQ, 1, word_mode, NULL_RTX, 0);
  6982.       if (compar == const_true_rtx)
  6983.     emit_jump (if_false_label);
  6984.       else if (compar != const0_rtx)
  6985.     do_jump_for_compare (compar, if_false_label, NULL_RTX);
  6986.     }
  6987.  
  6988.   if (if_true_label)
  6989.     emit_jump (if_true_label);
  6990.   if (drop_through_label)
  6991.     emit_label (drop_through_label);
  6992. }
  6993.  
  6994. /* Given a comparison expression in rtl form, output conditional branches to
  6995.    IF_TRUE_LABEL, IF_FALSE_LABEL, or both.  */
  6996.  
  6997. static void
  6998. do_jump_for_compare (comparison, if_false_label, if_true_label)
  6999.      rtx comparison, if_false_label, if_true_label;
  7000. {
  7001.   if (if_true_label)
  7002.     {
  7003.       if (bcc_gen_fctn[(int) GET_CODE (comparison)] != 0)
  7004.     emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_true_label));
  7005.       else
  7006.     abort ();
  7007.  
  7008.       if (if_false_label)
  7009.     emit_jump (if_false_label);
  7010.     }
  7011.   else if (if_false_label)
  7012.     {
  7013.       rtx insn;
  7014.       rtx prev = PREV_INSN (get_last_insn ());
  7015.       rtx branch = 0;
  7016.  
  7017.       /* Output the branch with the opposite condition.  Then try to invert
  7018.      what is generated.  If more than one insn is a branch, or if the
  7019.      branch is not the last insn written, abort. If we can't invert
  7020.      the branch, emit make a true label, redirect this jump to that,
  7021.      emit a jump to the false label and define the true label.  */
  7022.  
  7023.       if (bcc_gen_fctn[(int) GET_CODE (comparison)] != 0)
  7024.     emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_false_label));
  7025.       else
  7026.     abort ();
  7027.  
  7028.       /* Here we get the insn before what was just emitted.
  7029.      On some machines, emitting the branch can discard
  7030.      the previous compare insn and emit a replacement.  */
  7031.       if (prev == 0)
  7032.     /* If there's only one preceding insn...  */
  7033.     insn = get_insns ();
  7034.       else
  7035.     insn = NEXT_INSN (prev);
  7036.  
  7037.       for (insn = NEXT_INSN (insn); insn; insn = NEXT_INSN (insn))
  7038.     if (GET_CODE (insn) == JUMP_INSN)
  7039.       {
  7040.         if (branch)
  7041.           abort ();
  7042.         branch = insn;
  7043.       }
  7044.  
  7045.       if (branch != get_last_insn ())
  7046.     abort ();
  7047.  
  7048.       if (! invert_jump (branch, if_false_label))
  7049.     {
  7050.       if_true_label = gen_label_rtx ();
  7051.       redirect_jump (branch, if_true_label);
  7052.       emit_jump (if_false_label);
  7053.       emit_label (if_true_label);
  7054.     }
  7055.     }
  7056. }
  7057.  
  7058. /* Generate code for a comparison expression EXP
  7059.    (including code to compute the values to be compared)
  7060.    and set (CC0) according to the result.
  7061.    SIGNED_CODE should be the rtx operation for this comparison for
  7062.    signed data; UNSIGNED_CODE, likewise for use if data is unsigned.
  7063.  
  7064.    We force a stack adjustment unless there are currently
  7065.    things pushed on the stack that aren't yet used.  */
  7066.  
  7067. static rtx
  7068. compare (exp, signed_code, unsigned_code)
  7069.      register tree exp;
  7070.      enum rtx_code signed_code, unsigned_code;
  7071. {
  7072.   register rtx op0
  7073.     = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
  7074.   register rtx op1
  7075.     = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  7076.   register tree type = TREE_TYPE (TREE_OPERAND (exp, 0));
  7077.   register enum machine_mode mode = TYPE_MODE (type);
  7078.   int unsignedp = TREE_UNSIGNED (type);
  7079.   enum rtx_code code = unsignedp ? unsigned_code : signed_code;
  7080.  
  7081.   return compare_from_rtx (op0, op1, code, unsignedp, mode,
  7082.                ((mode == BLKmode)
  7083.                 ? expr_size (TREE_OPERAND (exp, 0)) : NULL_RTX),
  7084.                TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  7085. }
  7086.  
  7087. /* Like compare but expects the values to compare as two rtx's.
  7088.    The decision as to signed or unsigned comparison must be made by the caller.
  7089.  
  7090.    If MODE is BLKmode, SIZE is an RTX giving the size of the objects being
  7091.    compared.
  7092.  
  7093.    If ALIGN is non-zero, it is the alignment of this type; if zero, the
  7094.    size of MODE should be used.  */
  7095.  
  7096. rtx
  7097. compare_from_rtx (op0, op1, code, unsignedp, mode, size, align)
  7098.      register rtx op0, op1;
  7099.      enum rtx_code code;
  7100.      int unsignedp;
  7101.      enum machine_mode mode;
  7102.      rtx size;
  7103.      int align;
  7104. {
  7105.   /* If one operand is constant, make it the second one.  */
  7106.  
  7107.   if (GET_CODE (op0) == CONST_INT || GET_CODE (op0) == CONST_DOUBLE)
  7108.     {
  7109.       rtx tem = op0;
  7110.       op0 = op1;
  7111.       op1 = tem;
  7112.       code = swap_condition (code);
  7113.     }
  7114.  
  7115.   if (flag_force_mem)
  7116.     {
  7117.       op0 = force_not_mem (op0);
  7118.       op1 = force_not_mem (op1);
  7119.     }
  7120.  
  7121.   do_pending_stack_adjust ();
  7122.  
  7123.   if (GET_CODE (op0) == CONST_INT && GET_CODE (op1) == CONST_INT)
  7124.     return simplify_relational_operation (code, mode, op0, op1);
  7125.  
  7126. #if 0
  7127.   /* There's no need to do this now that combine.c can eliminate lots of
  7128.      sign extensions.  This can be less efficient in certain cases on other
  7129.      machines.
  7130.  
  7131.   /* If this is a signed equality comparison, we can do it as an
  7132.      unsigned comparison since zero-extension is cheaper than sign
  7133.      extension and comparisons with zero are done as unsigned.  This is
  7134.      the case even on machines that can do fast sign extension, since
  7135.      zero-extension is easier to combinen with other operations than
  7136.      sign-extension is.  If we are comparing against a constant, we must
  7137.      convert it to what it would look like unsigned.  */
  7138.   if ((code == EQ || code == NE) && ! unsignedp
  7139.       && GET_MODE_BITSIZE (GET_MODE (op0)) <= HOST_BITS_PER_WIDE_INT)
  7140.     {
  7141.       if (GET_CODE (op1) == CONST_INT
  7142.       && (INTVAL (op1) & GET_MODE_MASK (GET_MODE (op0))) != INTVAL (op1))
  7143.     op1 = GEN_INT (INTVAL (op1) & GET_MODE_MASK (GET_MODE (op0)));
  7144.       unsignedp = 1;
  7145.     }
  7146. #endif
  7147.     
  7148.   emit_cmp_insn (op0, op1, code, size, mode, unsignedp, align);
  7149.  
  7150.   return gen_rtx (code, VOIDmode, cc0_rtx, const0_rtx);
  7151. }
  7152.  
  7153. /* Generate code to calculate EXP using a store-flag instruction
  7154.    and return an rtx for the result.  EXP is either a comparison
  7155.    or a TRUTH_NOT_EXPR whose operand is a comparison.
  7156.  
  7157.    If TARGET is nonzero, store the result there if convenient.
  7158.  
  7159.    If ONLY_CHEAP is non-zero, only do this if it is likely to be very
  7160.    cheap.
  7161.  
  7162.    Return zero if there is no suitable set-flag instruction
  7163.    available on this machine.
  7164.  
  7165.    Once expand_expr has been called on the arguments of the comparison,
  7166.    we are committed to doing the store flag, since it is not safe to
  7167.    re-evaluate the expression.  We emit the store-flag insn by calling
  7168.    emit_store_flag, but only expand the arguments if we have a reason
  7169.    to believe that emit_store_flag will be successful.  If we think that
  7170.    it will, but it isn't, we have to simulate the store-flag with a
  7171.    set/jump/set sequence.  */
  7172.  
  7173. static rtx
  7174. do_store_flag (exp, target, mode, only_cheap)
  7175.      tree exp;
  7176.      rtx target;
  7177.      enum machine_mode mode;
  7178.      int only_cheap;
  7179. {
  7180.   enum rtx_code code;
  7181.   tree arg0, arg1, type;
  7182.   tree tem;
  7183.   enum machine_mode operand_mode;
  7184.   int invert = 0;
  7185.   int unsignedp;
  7186.   rtx op0, op1;
  7187.   enum insn_code icode;
  7188.   rtx subtarget = target;
  7189.   rtx result, label, pattern, jump_pat;
  7190.  
  7191.   /* If this is a TRUTH_NOT_EXPR, set a flag indicating we must invert the
  7192.      result at the end.  We can't simply invert the test since it would
  7193.      have already been inverted if it were valid.  This case occurs for
  7194.      some floating-point comparisons.  */
  7195.  
  7196.   if (TREE_CODE (exp) == TRUTH_NOT_EXPR)
  7197.     invert = 1, exp = TREE_OPERAND (exp, 0);
  7198.  
  7199.   arg0 = TREE_OPERAND (exp, 0);
  7200.   arg1 = TREE_OPERAND (exp, 1);
  7201.   type = TREE_TYPE (arg0);
  7202.   operand_mode = TYPE_MODE (type);
  7203.   unsignedp = TREE_UNSIGNED (type);
  7204.  
  7205.   /* We won't bother with BLKmode store-flag operations because it would mean
  7206.      passing a lot of information to emit_store_flag.  */
  7207.   if (operand_mode == BLKmode)
  7208.     return 0;
  7209.  
  7210.   STRIP_NOPS (arg0);
  7211.   STRIP_NOPS (arg1);
  7212.  
  7213.   /* Get the rtx comparison code to use.  We know that EXP is a comparison
  7214.      operation of some type.  Some comparisons against 1 and -1 can be
  7215.      converted to comparisons with zero.  Do so here so that the tests
  7216.      below will be aware that we have a comparison with zero.   These
  7217.      tests will not catch constants in the first operand, but constants
  7218.      are rarely passed as the first operand.  */
  7219.  
  7220.   switch (TREE_CODE (exp))
  7221.     {
  7222.     case EQ_EXPR:
  7223.       code = EQ;
  7224.       break;
  7225.     case NE_EXPR:
  7226.       code = NE;
  7227.       break;
  7228.     case LT_EXPR:
  7229.       if (integer_onep (arg1))
  7230.     arg1 = integer_zero_node, code = unsignedp ? LEU : LE;
  7231.       else
  7232.     code = unsignedp ? LTU : LT;
  7233.       break;
  7234.     case LE_EXPR:
  7235.       if (integer_all_onesp (arg1))
  7236.     arg1 = integer_zero_node, code = unsignedp ? LTU : LT;
  7237.       else
  7238.     code = unsignedp ? LEU : LE;
  7239.       break;
  7240.     case GT_EXPR:
  7241.       if (integer_all_onesp (arg1))
  7242.     arg1 = integer_zero_node, code = unsignedp ? GEU : GE;
  7243.       else
  7244.     code = unsignedp ? GTU : GT;
  7245.       break;
  7246.     case GE_EXPR:
  7247.       if (integer_onep (arg1))
  7248.     arg1 = integer_zero_node, code = unsignedp ? GTU : GT;
  7249.       else
  7250.     code = unsignedp ? GEU : GE;
  7251.       break;
  7252.     default:
  7253.       abort ();
  7254.     }
  7255.  
  7256.   /* Put a constant second.  */
  7257.   if (TREE_CODE (arg0) == REAL_CST || TREE_CODE (arg0) == INTEGER_CST)
  7258.     {
  7259.       tem = arg0; arg0 = arg1; arg1 = tem;
  7260.       code = swap_condition (code);
  7261.     }
  7262.  
  7263.   /* If this is an equality or inequality test of a single bit, we can
  7264.      do this by shifting the bit being tested to the low-order bit and
  7265.      masking the result with the constant 1.  If the condition was EQ,
  7266.      we xor it with 1.  This does not require an scc insn and is faster
  7267.      than an scc insn even if we have it.  */
  7268.  
  7269.   if ((code == NE || code == EQ)
  7270.       && TREE_CODE (arg0) == BIT_AND_EXPR && integer_zerop (arg1)
  7271.       && integer_pow2p (TREE_OPERAND (arg0, 1))
  7272.       && TYPE_PRECISION (type) <= HOST_BITS_PER_WIDE_INT)
  7273.     {
  7274.       int bitnum = exact_log2 (INTVAL (expand_expr (TREE_OPERAND (arg0, 1),
  7275.                             NULL_RTX, VOIDmode, 0)));
  7276.  
  7277.       if (subtarget == 0 || GET_CODE (subtarget) != REG
  7278.       || GET_MODE (subtarget) != operand_mode
  7279.       || ! safe_from_p (subtarget, TREE_OPERAND (arg0, 0)))
  7280.     subtarget = 0;
  7281.  
  7282.       op0 = expand_expr (TREE_OPERAND (arg0, 0), subtarget, VOIDmode, 0);
  7283.  
  7284.       if (bitnum != 0)
  7285.     op0 = expand_shift (RSHIFT_EXPR, GET_MODE (op0), op0,
  7286.                 size_int (bitnum), target, 1);
  7287.  
  7288.       if (GET_MODE (op0) != mode)
  7289.     op0 = convert_to_mode (mode, op0, 1);
  7290.  
  7291.       if (bitnum != TYPE_PRECISION (type) - 1)
  7292.     op0 = expand_and (op0, const1_rtx, target);
  7293.  
  7294.       if ((code == EQ && ! invert) || (code == NE && invert))
  7295.     op0 = expand_binop (mode, xor_optab, op0, const1_rtx, target, 0,
  7296.                 OPTAB_LIB_WIDEN);
  7297.  
  7298.       return op0;
  7299.     }
  7300.  
  7301.   /* Now see if we are likely to be able to do this.  Return if not.  */
  7302.   if (! can_compare_p (operand_mode))
  7303.     return 0;
  7304.   icode = setcc_gen_code[(int) code];
  7305.   if (icode == CODE_FOR_nothing
  7306.       || (only_cheap && insn_operand_mode[(int) icode][0] != mode))
  7307.     {
  7308.       /* We can only do this if it is one of the special cases that
  7309.      can be handled without an scc insn.  */
  7310.       if ((code == LT && integer_zerop (arg1))
  7311.       || (! only_cheap && code == GE && integer_zerop (arg1)))
  7312.     ;
  7313.       else if (BRANCH_COST >= 0
  7314.            && ! only_cheap && (code == NE || code == EQ)
  7315.            && TREE_CODE (type) != REAL_TYPE
  7316.            && ((abs_optab->handlers[(int) operand_mode].insn_code
  7317.             != CODE_FOR_nothing)
  7318.            || (ffs_optab->handlers[(int) operand_mode].insn_code
  7319.                != CODE_FOR_nothing)))
  7320.     ;
  7321.       else
  7322.     return 0;
  7323.     }
  7324.       
  7325.   preexpand_calls (exp);
  7326.   if (subtarget == 0 || GET_CODE (subtarget) != REG
  7327.       || GET_MODE (subtarget) != operand_mode
  7328.       || ! safe_from_p (subtarget, arg1))
  7329.     subtarget = 0;
  7330.  
  7331.   op0 = expand_expr (arg0, subtarget, VOIDmode, 0);
  7332.   op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
  7333.  
  7334.   if (target == 0)
  7335.     target = gen_reg_rtx (mode);
  7336.  
  7337.   /* Pass copies of OP0 and OP1 in case they contain a QUEUED.  This is safe
  7338.      because, if the emit_store_flag does anything it will succeed and
  7339.      OP0 and OP1 will not be used subsequently.  */
  7340.  
  7341.   result = emit_store_flag (target, code,
  7342.                 queued_subexp_p (op0) ? copy_rtx (op0) : op0,
  7343.                 queued_subexp_p (op1) ? copy_rtx (op1) : op1,
  7344.                 operand_mode, unsignedp, 1);
  7345.  
  7346.   if (result)
  7347.     {
  7348.       if (invert)
  7349.     result = expand_binop (mode, xor_optab, result, const1_rtx,
  7350.                    result, 0, OPTAB_LIB_WIDEN);
  7351.       return result;
  7352.     }
  7353.  
  7354.   /* If this failed, we have to do this with set/compare/jump/set code.  */
  7355.   if (target == 0 || GET_CODE (target) != REG
  7356.       || reg_mentioned_p (target, op0) || reg_mentioned_p (target, op1))
  7357.     target = gen_reg_rtx (GET_MODE (target));
  7358.  
  7359.   emit_move_insn (target, invert ? const0_rtx : const1_rtx);
  7360.   result = compare_from_rtx (op0, op1, code, unsignedp,
  7361.                  operand_mode, NULL_RTX, 0);
  7362.   if (GET_CODE (result) == CONST_INT)
  7363.     return (((result == const0_rtx && ! invert)
  7364.          || (result != const0_rtx && invert))
  7365.         ? const0_rtx : const1_rtx);
  7366.  
  7367.   label = gen_label_rtx ();
  7368.   if (bcc_gen_fctn[(int) code] == 0)
  7369.     abort ();
  7370.  
  7371.   emit_jump_insn ((*bcc_gen_fctn[(int) code]) (label));
  7372.   emit_move_insn (target, invert ? const1_rtx : const0_rtx);
  7373.   emit_label (label);
  7374.  
  7375.   return target;
  7376. }
  7377.  
  7378. /* Generate a tablejump instruction (used for switch statements).  */
  7379.  
  7380. #ifdef HAVE_tablejump
  7381.  
  7382. /* INDEX is the value being switched on, with the lowest value
  7383.    in the table already subtracted.
  7384.    MODE is its expected mode (needed if INDEX is constant).
  7385.    RANGE is the length of the jump table.
  7386.    TABLE_LABEL is a CODE_LABEL rtx for the table itself.
  7387.  
  7388.    DEFAULT_LABEL is a CODE_LABEL rtx to jump to if the
  7389.    index value is out of range.  */
  7390.  
  7391. void
  7392. do_tablejump (index, mode, range, table_label, default_label)
  7393.      rtx index, range, table_label, default_label;
  7394.      enum machine_mode mode;
  7395. {
  7396.   register rtx temp, vector;
  7397.  
  7398.   /* Do an unsigned comparison (in the proper mode) between the index
  7399.      expression and the value which represents the length of the range.
  7400.      Since we just finished subtracting the lower bound of the range
  7401.      from the index expression, this comparison allows us to simultaneously
  7402.      check that the original index expression value is both greater than
  7403.      or equal to the minimum value of the range and less than or equal to
  7404.      the maximum value of the range.  */
  7405.  
  7406. #if defined(APPLE_HAX) && defined(PTR_HACK)
  7407.   index = convert_to_mode (SImode, index, 1);
  7408.   /*vector = gen_rtx (MEM, TPmode, index);*/
  7409.   temp = gen_reg_rtx (SImode);
  7410.   /*RTX_UNCHANGING_P (vector) = 1;*/
  7411.   convert_move (temp, index, 0);
  7412.   emit_jump_insn (gen_tablejump (temp, table_label));
  7413. #else
  7414.  
  7415.   emit_cmp_insn (range, index, LTU, NULL_RTX, DPmode, 0, 0);
  7416.   emit_jump_insn (gen_bltu (default_label));
  7417.  
  7418.   /* If index is in range, it must fit in Pmode.
  7419.      Convert to Pmode so we can index with it.  */
  7420. #if !(defined(APPLE_HAX) && defined(PTR_HACK))
  7421.   if (mode != Pmode)
  7422.     index = convert_to_mode (Pmode, index, 1);
  7423. #endif
  7424.  
  7425.   /* If flag_force_addr were to affect this address
  7426.      it could interfere with the tricky assumptions made
  7427.      about addresses that contain label-refs,
  7428.      which may be valid only very near the tablejump itself.  */
  7429.   /* ??? The only correct use of CASE_VECTOR_MODE is the one inside the
  7430.      GET_MODE_SIZE, because this indicates how large insns are.  The other
  7431.      uses should all be Pmode, because they are addresses.  This code
  7432.      could fail if addresses and insns are not the same size.  */
  7433. #if defined(APPLE_HAX) && defined(PTR_HACK)
  7434.   index = memory_address_noforce
  7435.     (DPmode,
  7436.      gen_rtx (PLUS, DPmode,
  7437.           gen_rtx (MULT, SImode, index,
  7438.                gen_rtx (CONST_INT, VOIDmode,
  7439.                 GET_MODE_SIZE (CASE_VECTOR_MODE))),
  7440.           gen_rtx (LABEL_REF, DPmode, table_label)));
  7441. #else
  7442.   index = memory_address_noforce
  7443.     (CASE_VECTOR_MODE,
  7444.      gen_rtx (PLUS, Pmode,
  7445.           gen_rtx (MULT, Pmode, index,
  7446.                GEN_INT (GET_MODE_SIZE (CASE_VECTOR_MODE))),
  7447.           gen_rtx (LABEL_REF, Pmode, table_label)));
  7448. #endif
  7449. #if defined(APPLE_HAX) && defined(PTR_HACK)
  7450.   temp = gen_reg_rtx (TPmode);
  7451.   vector = gen_rtx (MEM, TPmode, index);
  7452. #else
  7453.   vector = gen_rtx (MEM, CASE_VECTOR_MODE, index);
  7454.   temp = gen_reg_rtx (CASE_VECTOR_MODE);
  7455. #endif
  7456.   RTX_UNCHANGING_P (vector) = 1;
  7457.   convert_move (temp, vector, 0);
  7458.  
  7459.   emit_jump_insn (gen_tablejump (temp, table_label));
  7460.  
  7461. #endif /*PTR_HACK*/
  7462. #ifndef CASE_VECTOR_PC_RELATIVE
  7463.   /* If we are generating PIC code or if the table is PC-relative, the
  7464.      table and JUMP_INSN must be adjacent, so don't output a BARRIER.  */
  7465.   if (! flag_pic)
  7466.     emit_barrier ();
  7467. #endif
  7468. }
  7469.  
  7470. #endif /* HAVE_tablejump */
  7471.